Game Development Reference
In-Depth Information
Figure 18-2. A screenshot of the PenguinPairs1 example program. That shark looks hungry, and that penguin looks tasty!
Because you handle all the sprite-sheet aspects in the SpriteSheet class, it's straightforward to draw
the penguin exactly in the middle of the screen, as follows:
this.penguin.position = this.penguin.screenCenter;
This will work for any sprite sheet of any dimension! Try the PenguinPairs1 program, and play around
with the code to see how it works.
What You Have Learned
In this chapter, you have learned:
split method to analyze strings
How to handle sprite sheets in games
How to use the
 
Search WWH ::




Custom Search