Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: sprite in 1:1 scale appearce centered in the screen(flickering)  (Read 1656 times)

0 Members and 1 Guest are viewing this topic.


  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
Hello :-),

Excuse:- first i hope that i hit a general problem and nothing special from the java bindings, if so i will move              .           - on.               
.           - Please dont judge.
.           - sorry for my english

Problem:- My problem is that, when i move my sprites over the screen (i got serveral sprites from an animation in an array (all sprites are solo pictures)) they do flicker. that means these sprites are a walking animation but i scale them every time the player moves or turn direction (it's an sidescroller). 1. i see a sprites where it belongs on the screen 2. i see a sprites which is huge (i think a the original scale) in the center of the screen. then it repeats
here i support the scaling line
a=is the for counter(should be clear)
animationState=stores an integer which says which animation is to player
targetSize.x=the screensize in horizontal way
player_s=is the 2d sprites array ([which animation][the animation itself] like a chart)
playerScaleX= an integer which gives a size how often the player char fits horizontal and vertical
            for (int a=0; a<Integer.valueOf(charANIM.getJSONObject("animation").getString(String.valueOf(animationState))); a++) {
              player_s[animationState][a].setScale(-(targetSize.x/player_s[animationState][a].getGlobalBounds().width/playerScaleX), targetSize.y/player_s[animationState][a].getGlobalBounds().height/playerScaleY);
here i support a video of my problem: https://streamable.com/mtkfrw

if you need more please ask
so on thank for your help
by pizzadox
contains java ports of Hapax's c++ libs