O'Reilly logo

Beginning Java 8 Games Development by Wallace Jackson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 13

image

Animating Your Action Figure States: Setting the Image States Based on KeyEvent Processing

Now that we have also organized your Java code into logical methods in the Bagel.java class, as well as making sure that all of our Java code is standards compliant in Chapters 11 and 12, it is time to get into some more complicated code structures that will animate our InvinciBagel character on the screen as the user moves the character. For instance, if the character is traveling due East or due West (using only left or right keypresses, to travel in a straight line), he should be running (alternating between the imageStates(1) and imageStates(2) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required