3D Game Programming

(C. Jardin) #1
collision avoidance, 97
if and else keyword con-
trols, 76
keycodes, 37
purple fruit monster
game, 140
river-rafting game, 197
tilt-a-board game, 145 ,
152–153
walking animation, 63–65
aspect ratio, 87 , 214
assignment operator, 38 , 74
assignments, property, 20
asterisk, multiplication with,
62 , 70
attributes, 160
avatars
camera following, 43–47,
82
cartwheel animation, 32–
33 , 39 , 44 , 61 , 66
cave-puzzle game, 168
collision detection, 93–
98 , 230–234
creating simple, 25–32,
136 , 168 , 219
defined, 25
flipping animation, 32 ,
34 , 39 , 44 , 61 , 66
jumping, 103
moving, 35–47, 140 , 220–
222
moving hands and feet,
59–66, 223–226
purple fruit monster
game, 136–138, 140
rotating, 79–84, 226–229
separating parts, 39
starting and stopping, 97
walking animation, 61–66
axis of rotation, 81

B
backgrounds
cave-puzzle game, 166
MeshNormalMaterial, 110
solar-system project, 120
starry, 120 , 155
tilt-a-board game, 155
backup code, 178
balls, see also spheres
shadows, 147 , 149
tilt-a-board game, 145–
157 , 249–253
beams, tilt-a-board game, 151
blocks, if and while, 75

Blogger, 212
board-tilting game, 145–157,
249–253
board.rotation[dir], 152
bodies, creating, 26–32
<body> tags, using, 85
boilerplate code, 85–91
bonus items, 202–205
Booleans, 39 , 73 , 96
borders, game, 167
bounciness, 169
boundaries
collisions and, 94–98
game, 167
boxes, creating, 6–8
brackets
curly, 54 , 160
square, 77
breaking things
project, 17–24
to learn, 55–56
brightness
hexadecimal numbers,
166
specular attribute, 112
browsers, see web browsers
buildObstacle(), 181
bunching variables, 122

C
cameras
adjusting borders for,
168
boilerplate code, 87–91
frame of reference, 127
moving with avatar, 43–
47 , 82
orthographic, 89–91, 167
perspective, 7 , 90 , 168
positioning for games,
134 , 147 , 186
renderers and, 88–89
resetting, 197
river-rafting game, 197
shadow rendering, 188
solar-system project, 121
switching between, 122 ,
130
capitalization, 22 , 162
cartwheel animation
acrobatics() function, 61
camera position, 44
creating, 32–33
keyboard controls, 66
stopping and starting, 39

castShadow attribute, 114
cave puzzle
basic game, 165–176,
255–259
multilevel game, 177–
184 , 259–265
chaining methods, 84
cheating when programming,
11 , see also laziness
checkForGameOver(), 200
checkForTreasure(), 104
Chrome, xv, 2
chunkiness, shape, 5–6, 10 ,
12
circular motion in solar-sys-
tem projects, 119 , 127
click sound, 183
clock variable, 115
clocks, see timers
closing, JavaScript console,
18
code, see also code, project
backup, 178
boilerplate, 85–91
hiding, 5
outlining, 135 , 186
publishing to web, 207–
215
readability, 50–53
repeating with while, 74
skipping with if, 74 , 76
splitting, 179
code editors, see ICE Code
Editor
code, project
avatar movement, 220–
222
cave puzzle, 255–265
collision detection and
avoidance, 230–234
creating simple avatars,
219
creating simple shapes,
217
fruit-hunt game, 234–240
lights and materials,
240–241
message-logger function
example, 222
movie example of Java-
Script objects, 253–255
moving hands and feet,
223–226
phases of the moon, 243–
245

Index • 280


Prepared exclusively for Michael Powell

Free download pdf