O'Reilly logo

DarkBASIC Pro Game Programming, Second Edition by Joshua R. Smith, Jonathan S. Harbour

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

Darkanoid Revisited

Let’s add some more features to the Darkanoid game. Now that you’ve learned how collision testing works and have seen some example code, I think you’ll be able to add this new capability to Darkanoid very easily. The new collision code in the game will make it possible to deflect the ball using the paddle (although you still can’t “lose” by missing the ball—yet). The ball also hits blocks and makes them disappear. This is done by simply setting the blockData array value to zero whenever a block is destroyed. Then, next time through the game loop, that particular block is not drawn. The new changes definitely help this game feel more functional, as you can see in Figure 12.8.

Figure 12.8. The latest improvements to Darkanoid ...

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