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

Poof! Now You See It, Now You Don’t

One type of collision you’ll want to create often is having one object disappear when it hits another. This is perfect when you create things like bullets that hit enemies, since you’ll want the enemies to disappear. We’ll keep things simple in this example. We’ll have one object (a cone) disappear when it is hit by a sphere. Demo11-04.bb shows how to do this. This program controls a sphere that can collide with a cone. When you run the program, you’ll see that you can control the sphere, but it can’t go through the cone since a collision has been created. The following code makes the disappearing occur!

; This following code makes our program run While Not KeyDown( 1 ) x#=0 y#=0 z#=0 If KeyDown( 203 )=True ...

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