Game Development Reference
In-Depth Information
There are other specialized classes that are working simultaneously with @qjcakjKja[I]j]can:
Lh]uan: Contains the player's keyboard control system. It also keeps track of whether the key
has been picked up.
S]hh: Sends references of all the s]hh instances to the @qjcakjKja[I]j]can class to help with
collision detection between the walls and the player.
@kkn: Keeps track of whether the doors are open or closed. It also plays a sound when the door
is opened.
Sa]lkj: Lets the player fire bullets. It creates new instances of the >qhhap class and adds them
to the stage.
>qhhap: Controls the bullets' movement.
As long as all the classes are in the same project folder, they can communicate with each other.
Let's take a look at the @qjcakjKja[I]j]can class. It's a very long class, but don't let that scare you.
Most of the game logic is in the kjAjpanBn]ia event handler, and I numbered and highlighted each
important section with code comments. You'll see that you can break each of the major occurrences
in the game down into very manageable and almost mundane eb/ahoa statements.
A good way to read the code is while you're playing the game. When you complete a specific task in
the game, such as picking up the key, see if you can figure out how code actually makes it work. I used
numbered comments in the code to walk you through it. You'll recognize most of this code immedi-
ately from other chapters. I'll explain the all-new code, and how this code integrates with the other
classes, in the pages ahead.
DungeonOne_Manager class
Search Nedrilad ::

Custom Search