Activity 12.1 - Playing the game
Topic
This Activity allows you play the game described in Unit 12.
Instructions
- Run the project Ex12_1. The mobile phone
emulator should be displayed. (If you have a firewall, you may need to
give permission to the emulator to run.) When the game is running
(you will see the time counting down in the top right-hand corner)
try pressing the multi-directional key on the phone
(or the cursor keys on your keyboard) to move the robot to the
star portal before the time runs out. We have not provided any code to
recognise when the robot reaches the star portal - this is explored
further in the second Unit 12 activity.
Pressing the soft key under the word Exit (or pressing F1 on your
keyboard) at any time will end the game and return you to the launch
screen.
Pressing the phone's Off button (or pressing Escape on your
keyboard) will close and quit the emulator.
- Launch the game again and this time open the Application menu on
the toolbar at the top and select Suspend. This simulates an incoming
telephone call. Note that the game is suspended and the timer stops
counting down. Now open the Application menu again and select Resume. The
game will continue from where it was stopped when the incoming call was
received.
- You may like to open the class Game and
experiment with varying the layout of the maze. To do this edit the
entries in the array map that is used in the method createBackground().
The possible values are 0 (empty), -1 (animated water), 1 (sand) and 6
(a tree).
Notes
If you have altered the background and want to revert to the
original, the array is
int[] map = {
0, 1,-1,-1,-1, 0, 0, 0,
0, 1, 1,-1, 0, 0,-1, 0,
0, 0, 0,-1, 0,-1, 0, 0,
6, 6, 0,-1, 0, 1, 0, 6,
0, 0, 0,-1, 0, 1, 0, 0,
0, 1, 0,-1, 0, 1, 1, 0,
0, 0, 1, 0, 0, 6, 0, 0,
6, 0, 0, 0, 6, 0, 0, 6
};