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

Input

Finally, you understand how variables work. Now, let’s use those variables to get input from the user of the program. Using input, you can recognize what keys the user presses, or you might have the user answer a question. Either way, most input is stored in a variable. Figure 2.7 shows the output of this program.

Figure 2.7. The demo02-04.bb program.

;demo02-04.bb asks user's name and shows it
;get the user's name
name$ = Input$("Hi! May I know your name please? ")
Print "Hi " + name$ + "."

;Wait five seconds
Delay 5000

The first line is a comment that tells what the program does. The second line takes in the input, and the third and ...

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