Rapid fire bullets

I've been addicted to games since Pong in the '70s, and remember my delight when a friend actually had a Space Invaders machine in his home for about a week. Although what really made asteroids so much better than Space Invaders, was how quickly you could shoot. In that tradition, we will make a satisfying, rapid fire stream of bullets.

Create a new class called Bullet, which has one vertex and will be drawn with a point. Note that we also declare and initialize an inFlight Boolean.

public class Bullet extends GameObject { private boolean inFlight = false; public Bullet(float shipX, float shipY) { super(); setType(Type.BULLET); setWorldLocation(shipX, shipY); // Define the bullet // as a single point // in exactly the coordinates ...

Get Android Game Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.