3D Game Programming

(C. Jardin) #1
draggable ramps, 173
images, 141
mesh variable, 173
MeshBasicMaterial(), 110
MeshNormalMaterial(), 110 , 164
message-logger function exam-
ple, 49–58, 222
messages, scoreboard
game over, 174
help, 100 , 189 , 275
methods, 275
method chaining, 84
methods
“undefined” error mes-
sages, 22
chaining, 84
creating, 164
defined, 161
Microsoft Internet Explorer,
xv, 2
moon-phases project, 125–
132 , 243–245
mouse controls, cave-puzzle
game, 166 , 173
Mouse.js, 166 , 173
move(), 170 , 172
Movie(), 163
movie example of JavaScript
objects, 160–164, 253–255
Mozilla Firefox, 2
multilevel games
cave puzzle, 177–184,
259–265
river-rafting game, 185–
205 , 265–272
multiplication, 62 , 70

N
names, function errors, 56
negative numbers, 70 , 170
new keyword
creating scoreboards, 100
object construction, 162–
164
new moon, 131
“no method” error message,
22
normals, recomputing, 193
“not defined” error messages,
22
not operator, 39 , 73
not_allowed, 96
null things, 68

numbers
decimal points, 204
hexadecimal, 166
in JavaScript, 69
negative, 70 , 170
random, 170 , 203
RGB color, 110 , 112
treated like strings, 73

O
object-oriented programming,
159–164, 179
Object.create, 161
objects
constructing, 162–164
copying, 161
defined, 160
erasing, 180
immovable, 177 , 181
JavaScript, 159–164
Levels, 179
properties and, 179
obstacles
cave-puzzle game, 177 ,
181
multilevel games, 178
on-dom-ready, 211
onComplete(), 274
onStart(), 274
onUpdate(), 274
opacity, goal lights, 154–155
opening, JavaScript console,
18
orbits in solar-system
projects, 119 , 127
order of operations, 70
orthographic camera, 89–91,
167
outlining code, 135 , 186

P
parameters, undefined, 155
parentheses
errors, 19 , 56
grouping math with, 70
particle systems, solar-system
project, 120 , 155
patterns, 94
pause variable, 129
pausing
cave-puzzle game score-
board animation, 175
phases of the moon simu-
lation, 129–130
river-rafting game, 198

penalizing players, 107
performance
chunks and, 6
shadows and, 113
period character, method
chaining, 84
perspective cameras
3D and, 7 , 90
adjusting game borders
for, 168
phases-of-the-moon project,
125–132, 243–245
Phong material, shininess ex-
ample, 111–113
physics
0 constant, 151
cave-puzzle game, 166 ,
169
__dirtyPosition, 149 , 172
mouse controls, 166
pausing, 175 , 200
purple fruit monster
game, 133 , 136–138
tilt-a-board game, 146
Physijs, about, 133 , 273 , see
also physics
pi, 71
placeGoal() , 171
planes
creating, 11
warping to create rivers,
189–193
water in river-rafting
game, 193
planets in solar-system
project, 119–123
platforms in cave-puzzle
game, 182
players, defined, 25 , see al-
so avatars
plus operator
addition with, 69
joining strings with, 73
point lights, 118 , 148
points, game
fruit-hunt game, 103
penalties, 107
power-up, 202–205
river-rafting game, 200–
205
scoreboard methods, 275
points, ray, 96
positioning
avatar with arrow keys,
38

Index • 284


Prepared exclusively for Michael Powell

Free download pdf