purple fruit monster,
245–249
river rafting, 265–272
rotating avatar, 226–229
solar-system project,
241–243
tilt-a-board game, 249–
253
collisions
cave-puzzle game, 169–
170 , 182
detecting and avoiding,
93–98, 230–234
goal in tilt-a-board game,
154
multiple in purple fruit
monster game, 136–
138
river-rafting game, 204
color
ambient, 113 , 118
backgrounds, 166
changing, 109–113
emissive attribute, 112
goal lights, 154–155
hexadecimal numbers,
166
list, 43 , 110
RGB numbers, 110 , 112
solar-system project, 118
specular attribute, 112
trees, 43
color attribute, 113
commenting out, 135
comments
double-slash notation, 69
using, 69 , 135
while statements, 120
compile-time errors
defined, 20
functions, 55
computeFaceNormals(), 193
computeVertexNormals(), 193
cones, creating, 10
console.log(), 160–161
constructors
object, 162–164
ramps, 171–174
control keywords, 74–76
controls, see keyboard con-
trols; mouse
coordinates, converting, 205
copying
objects, 161
in programming, 27
projects, 35
this, 180
corners, pulling, 192
cosine
curve, 102
JavaScript function, 71–
72
solar-system animation,
119
countdown timers, see al-
so timers
multilevel games, 181
scoreboard, 100 , 174 ,
181 , 276
covers, see materials
crescent moon, 131
cubes, creating, 6–8
curly braces
function notation, 54–55
JavaScript objects, 160
cylinders, creating, 9–11
D
debugging
in ICE Code Editor, 19 ,
86
in JavaScript console,
19–23
decimal points, 204
defining errors, 22
degrees, see radians
describing, in JavaScript, 67 ,
160
Despicable Me, 137
digRiver(), 191
direction
avatar, 79–84, 226–229
collision avoidance, 97
directional lights, 187
dirty, defined, 149
__dirtyPosition, 149 , 172
__dirtyRotation, 152 , 172 , 198
discs, creating, 9
distance points, 200
<div> and web hosting, 213
division, 70
documentation, JavaScript,
273–278
domElement property, 88
DOMContentLoaded, 212
Don’t Repeat Yourself (DRY)
principle, 51
donuts
creating, 12–14
raft from, 195
shadow example, 113
shininess example, 111–
113
spinning, 115
double-slashe notation, 69
draggable ramps, 171–174
DRY principle, 51
E
?e option for ICE Code Editor,
23 , 120
Earth
phases-of-the-moon
project, 127
solar-system project,
119–123
eat(), debugging example, 20
edit-only mode for ICE Code
Editor, 23 , 120
?edit-only option for ICE Code
Editor, 23 , 120
else, 76
else if, 76
emissive attribute, 112
equals character notation,
38 , 74
erasing objects, 180
errors
compile-time, 20 , 55
definition, 22
functions, 55–56, 190
HTML, 86
in ICE Code Editor, 19 ,
86
in JavaScript console,
20–23
line numbers, 21
quotes, 54 , 68
run-time, 20
spelling, 21
event listener
avatar movement, 36–40,
46 , 140
camera switching, 122 ,
130
cartwheels and flips, 66
cave-puzzle game, 169–
170 , 173 , 182
collision detection and
avoidance, 97 , 136–138
draggable ramps, 173
goal in tilt-a-board game,
154
Index • 281
Prepared exclusively for Michael Powell