• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Understanding graphic editing...

update is probably called every frame to update the scene, although it's pretty flawed because it doesn't use a deltaTime system.

The first if makes sure that the sprite doesn't pass over the right border of the screen. Instead, it makes it go the opposite way when it reaches that point.

The second if is the same, but for the left border of the screen.

x += xSpeed is just updating the position of the sprite every frame

And the last line is updating the animation of the sprite by going a different bitmap frame every game frame. The modulus operator makes sure the animation just loops back to start when it goes over the last animation frame
 
Back
Top Bottom