3D Game Programming

(C. Jardin) #1
borders, 168
camera for games, 134 ,
147 , 186
camera to follow avatar,
43–47, 82
directional lights, 187
feet, 30 , 62–63
fruit spinning animation,
106
goal for cave-puzzle
game, 170
hands, 28–29, 59 , 62–63
ramps for cave-puzzle
game, 172
spheres, 6
spinning avatar anima-
tion, 82
trees, 42
walking animation, 62–63
power-up points, 202–205
premature generalization, 53 ,
149
programming
cheats, 11
copying in, 27
frustrations, 17
laziness, 27 , 129
object-oriented, 159–
164 , 179
outlining code, 135 , 186
readability, 50–53
project code, see code, project
properties, objects and, 179
property assignments, 20
prototypes, 162 , 164
publishing code to Web, 207–
215
pulling corners, 192
purple fruit monster game,
89–91, 133–143, 245–249
push onto lists, 96 , 101 , 180
pushRaft(), 198
puzzle, cave
basic game, 165–176,
255–259
multilevel game, 177–
184 , 259–265
pyramids, creating, 10
Pythagorean theorem, 104

Q
quarter moon, 131
quotes, closing, 54 , 68

R
radians, 71 , 81
raft, creating, 195
rafting game, 76 , 185–205,
265–272
ramps, draggable, 171–174
random goals, 170 , 203
random numbers, 170 , 203
rays and intersections, 94–98
readability, code, 50–53
recursion, 57 , 155
red X errors, 19 , 86
reference, frame of, 127–129,
205
renderer variable, 214
renderer.render(), 88
renderers
boilerplate code, 88–89
defined, 88
pausing animations, 129–
130
shadows, 113
shininess, 111
size and web hosting, 214
switching, 111
repeating
code with while, 74
DRY programming princi-
ple, 51
sounds, 277
requestAnimationFrame(), 116
resetBall(), 149 , 154
resetItems(), 202
resetting
ball in tilt-a-board game,
149 , 154
bonus items, 202
purple fruit monster
game, 138 , 143
river-rafting game, 196
retrograde motion, 123
return in functions, 54
RGB numbers, 110 , 112
river
adding items to, 203
creating, 189–193
river-rafting game, 76 , 185–
205 , 265–272
river_points property, 203
road for purple fruit monster
game, 89–91
rotate() method, 172

rotating
π and, 71
animation for shapes, 14
avatars, 79–84, 226–229
camera in solar-system
project, 122
cartwheel animation, 32–
33
cylinders and tubes, 9
dirty, 152 , 198
flipping animation, 34
fruit spinning animation,
106
game board, 152
phases-of-the-moon
project, 128
planes and flat surfaces,
12
ramps for cave-puzzle
game, 172–173
river-rafting game, 191 ,
198
shapes to see 3D, 7
solar-system project, 119
spinning donut, 115
run-time errors, defined, 20

S
saving
backup code, 178
work in ICE, 4
scene.simulate(), 138
scenes
boilerplate code, 87
camera aspect ratio, 87
defined, 4
game-over check, 138
multilevel games, 178 ,
180
pausing, 200
physics-enabled, 134 ,
147
scorePoints(), 104
Scoreboard.js, methods, 274–
277 , see also scoreboards
scoreboards, see also goals
cave-puzzle game, 166 ,
174 , 179 , 181
fruit-hunt game, 100 ,
105
help messages, 100 , 189
methods, 274–277
multilevel games, 179 ,
181
pausing, 198
purple fruit monster
game, 133 , 138
resetting, 197

Index • 285


Prepared exclusively for Michael Powell

Free download pdf