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) ...

Get Beginning Java 8 Games Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.