• 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
 
  • Like
Reactions: jon80
Upvote 0
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones