November 2011
Beginner
196 pages
5h 3m
English
Listing 9-12 contains code for the entire GameView.java update() method that deals with the boats.. If you don’t understand a portion of it, type it in its entirety and run the game. You can see how it works based on the game’s behavior.
1. Make sure that your update() method includes all of the code here. After the listing, you will find a explanation of it.
Listing 9-12. Setting Up the Boats in the update() Function
public void update(int adj_mov) {
for(int i = 0; i < boat_count; i++){
if((int)boat[i].getX() > 950){
boat[i].setMoveX(0);
boat[i].setMoveY(3); boat[i].setBitmap(BitmapFactory.decodeResource(getResources(), ...Read now
Unlock full access