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 Multiple Cones

Now that you’ve created one cone, I’m going to show you how you can create others and position them in different locations on your screen. I’ll also demonstrate that you can give your cones any names you’d like. Start off by deleting the cone you created earlier by erasing this code in your program:

; This is the code for creating the cone
cone=CreateCone()
PositionEntity cone,0,0,5

Now replace that code with the following, and run it once you are finished.

;Create and position four cones
coneleft = CreateCone()
PositionEntity coneleft,-3,2,5
apple = CreateCone()
PositionEntity apple,3,1,5
cone = CreateCone()
PositionEntity cone,-3,-2,5
coneyisland = CreateCone()
PositionEntity coneyisland,0,0,5

You should end up with ...

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