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

Creating the Guns and Bullets

The gun for our game will simply be a cylinder that we will “attach” to the camera so that wherever we move the camera, the gun will follow. The bullets will be copies of the missile that we created in 3ds Max earlier in the book. If you happened to skip Chapter 10, “3D Modeling,” you have these options: you can go back and create the missile or grab the file from the CD or download it from our website. Let’s start by creating the code in bold for the gun:

EntityType snake(x), type_gallery
         EntityRadius snake(x), 5
      Next
;Creating the gun gun=CreateCylinder(12) ScaleEntity gun,0.2,0.6,0.4 RotateEntity gun,45,0,0 PositionEntity gun, EntityX(camera),EntityY(camera)-2, EntityZ(camera)+3 EntityOrder gun, -1 EntityParent ...

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