Game Development Reference
In-Depth Information
}
try {
Thread.sleep(1500);
}
catch (Exception e){
e.printStackTrace();
}
}
}
Owl Icon
The appearance of the Owl Icon is shown in figure 5.2.
Figure 5.2 Owl Icon
First, let's define a rectangular area to capture the screen touch events.
//Creates a new rectangle with the specified coordinates.
//Parameters
//
left - The X coordinate of the left side of the rectangle
//
top - The Y coordinate of the top of the rectangle
//
right - The X coordinate of the right side of the rectangle
//
bottom - The Y coordinate of the bottom of the rectangle
Rect
rectPAUSED
=
new
Rect(OWL_X,OWL_Y,OWL_X+TAP_SIZE,OWL_Y+TAP_SIZE);
Then implement the startGame() and pauseGame() methods. The startGame() method will
be called when the player touches the rectangular area and the game is in PAUSED state,
while the pauseGame() method will be invoked when the player touches the rectangular
area and the game is in RUNNING state.
Search WWH ::




Custom Search