Game Development Reference
In-Depth Information
jjf
is the root package under which we find
game
, which contains the sources for
card management and visual movement of the frogs on the map. The
graphics
package is a simple embedding of the resources found in the
rsrc
folder. The
gsrc
is
the generated class file from the Pulse modeler. Finally, the
ui
package contains the
screen management for the game.
The map and frog movement
Let us first look at the
Map
class. It essentially draws the map background, the steps,
and also the frogs in the map.
In this implementation, there is no background imageāit is empty. The map is a
sprite, which is added to the stage by the game screen class that we will visit later.
The 10 spots are added as children of this instance as well as the five frogs.
The map contains 10-step instances for each step that is seen by the player. There are
five frog instances, one for each color.
In the constructor, we call
addStep
, a private method that draws a step at a
predetermined position. The
addFrog
method is called to put a frog within the map.