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

The First Program: Jumping Cone

;demo01-01.bb - Jumping Cone, your first program!
;------------------------------------------------

;Set up the graphics
Graphics3D 640, 480
SetBuffer BackBuffer()
;Define constants
Const ESC_KEY    = 1
Const UP_KEY     = 200
Const DOWN_KEY   = 208

;Define variables
camdistance = 10
type_player = 1
type_ground = 2

;track the position and jump of the cone
velocity#    = 0

This is the end of the declaration section of the code. This part sets up the important variables for the program as well as some constants. (Don’t worry; you will be introduced to all of this as the book progresses.)

After the declaration, we begin the initialization. Initialization is the process of setting up everything that will be used in the program—in ...

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