if and else keyword con-
trols, 76
jumping, 103
pausing animations, 130
purple fruit monster
game, 136–138, 140
resetting games, 143
river-rafting game, 197
tilt-a-board game, 152–
153
walking animation, 63–65
web-page loading, 211
exclamation point, 39 , 73
Explorer, xv, 2
F
faces, 191 , 193
facing proper direction, 79–
84 , 226–229
feet
creating, 29–31
moving, 59–66, 223–226
separating from avatar,
39
finish line, river-rafting game,
198–200
Firefox, 2
first-quarter moon, 131
flashGoalLight(), 154
flashing lights, 154
flat surfaces
creating, 11
MeshNormalMaterial, 110
warping, 189–193
flipping animation
acrobatics() function, 61
camera position, 44
creating, 32 , 34
keyboard controls, 66
starting and stopping, 39
forEach(), 77
forest, creating, 40–43
frame of reference, 127–129,
205
free web hosting, 212
freeze-ups, 14 , 23 , 120
frequency, wave, 193
fruit monster game, 133–
143 , 245–249
fruit, power-up, 202–205
fruit-hunt game, 99–107,
234–240
full moon, 131
functions
arguments, 54 , 56
bunching variables, 122
capitalization, 162
components of, 53
debugging with, 20
errors, 55–56, 190
geometric, 71–72
lists, 77
message-logger example,
49–58, 222
method chaining, 84
null or undefined things, 68
object construction, 162
recursive, 57
reusing code with, 41 , 50
skeleton, 190
this keyword and, 180
tree creation, 41
using, 49–58
G
game board, tilt-a-board
game, 150
game logic, tilt-a-board game,
156
game over
check, 138 , 200
message, 174
game projects
cave puzzle, 165–184,
255–265
fruit-hunt game, 99–107,
234–240
purple fruit monster,
133–143, 245–249
river rafting, 185–205,
265–272
tilt-a-board, 145–157,
249–253
gameOver(), 174
gameStep()
cave-puzzle game, 175
pausing and, 199
purple fruit monster
game, 139
river-rafting game, 199–
200
scoring and, 200
tilt-a-board game, 156
geometry
cubes, 7
cylinders, 9–11
defined, 4
donuts, 12
JavaScript functions, 71–
72
planes and flat surfaces,
11
rays, 94
rotating avatar, 81
spheres, 4
Get WebGL site, xvi
getElementById(), 215
gibbous moon, 132
goals, see also scoreboards
cave-puzzle game, 169–
170 , 182
multilevel games, 182
random placement, 170 ,
203
river-rafting game, 198–
200
sound effects, 183
tilt-a-board game, 153–
155
Google Chrome, xv, 2
graphics, adding simple, 141
gravity
adding, 134 , 146
deselecting with 0 con-
stant, 151
river-rafting game, 186
gray and specular colors, 112
ground
adding, 136
creating for river-rafting
game, 190–192
grouping, 32 , 47
guitar sound, 183
H
hacking, defined, 55
hands
creating, 26–29
moving, 59–66, 223–226
hasMoreLevels(), 181
height field mesh, 191
hello() function, 53–58
help messages, scoreboard,
100 , 189 , 275
hexadecimal numbers, 166
hiding code, 5
HTML
about, 85
boilerplate code, 85 , 87
markup, 210
tagging when posting
games, 213
Hypertext Markup Language,
see HTML
Index • 282
Prepared exclusively for Michael Powell