O'Reilly logo

Beginning Android Tablet Games Programming by Jeremy Kerfs

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Deploying and Managing the Attack Boats

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(), ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required