O'Reilly logo

3D Game Programming for Teens, Second Edition by Eric Grebler, Maneesh Sethi

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

Changing the Gallery

Because we have our collisions set up, we can now control how different objects in our game interact with one another. To add an additional element of difficulty to our game, we’ll have the gallery items change their location whenever they hit the ground. We’ll use a For . . . Next statement that will check every gallery item to see if it has collided with the ground. If a collision has occurred, we’ll reposition the item that has collided with the ground to a random location on the playing field. If you are unclear on the code used here, review Chapter 11, “Collisions.” Enter the following code in bold:

MoveEntity dolphin(a), 0,-0.2,-0.3
      Next
;Changing the position of gallery items For q = 0 To maxbull If CountCollisions ...

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