621
Index
2D arrays, 210A
ActionScript 2 (AS2), 6-7 ActionScript 3.0 (AS3), 6-7Adobe Flash Platform Distribution service, 579
Adobe Flash Platform Shibuya service, 579 Adobe Flash Platform Social service, 579 ads, in games and web pages, 575 AI for computer players, 379, 389–90, 395–
400, 405
AIR-based applications, distributing, 579 Amayeta SWF Encrypt, 580
animated objects, 521–30 animated sprites, 166–71 API licenses, 577
application background. See background arrays, 210
art-based scrolling, 411 AS2 (ActionScript 2), 6-7 AS3 (ActionScript 3.0), 6-7 assets
accessing from library, 144–47, 232 adding to library, 140–44
for Balloon Saw game, 17–18 for Blaster Mines game, 508, 518–21
for Color Drop game, 333–34 for Dice Battle game, 371–72 for Drive She Said game, 427–29 for Flak Cannon game, 140–47 for No Tanks! game, 209–11,
231–33, 305
for Pixel Shooter game, 31–32 for Tunnel Panic game, 587–92, 609 Atari, history of, 138–39
auto racing. See Drive She Said game
B
background, 63, 93
for No Tanks! game, 217, 219, 246–48, 304
for Super Click game, 110
See also tile sheets background fill variables, 61 Balloon Saw game, 17–30
assets, 17–18 balloons creating, 27 moving, 28 code, 19–22 collision detection, 28–29 ending, 30 game constructor, 24 game timer, 26
Balloon Saw game (continued) graphics, 17–18 importing classes, 23 project settings, 19 scoreboard, 25 sounds, 18 state loop, 25 testing, 22 variables, 24 basic screen, 46, 47, 70–73 Bit Boy game, 478
Bit Trip Beat game, 477 Bit Trip Core game, 477 Blaster Mines game, 478–570
animated objects, 521–30 assets, 508, 518–21 collision detection, 557 designing, 478
frame rate profiler, 485–92, 507–8 frame rate, monitoring, 493–97 game initialization and
startup, 538–52 Game.as class, 497–98 look-up tables, 514–16 Main.as class, 500–510 memory conservation, 510, 514 memory usage, monitoring, 493–97 mines, 531, 537
muting, 481, 506, 509 object pooling, 510–13 optimizations, 510–18
particles from explosions, 533–34 pausing, 481, 506 player, moving, 526–30 project, creating, 498–500 projectiles, 535–37 radar screen, 517 scoreboard, 505
screen-based blit scrolling, 516 single-unit processing, 513 stage availability, 481, 506 state loop, 552–54
time-based step timer, 482–85, 507, 552–54
blit scrolling
screen-based, 516 tile-based, 411 blitting, 233, 234, 235–38
combining methods of, 236 full-screen blit, 235, 237 hardware blitting, 234
individual object blitting, 235–7 performance of, 236–38 bounding box collision detection, 28 buttons, in game framework, 46, 47,
74–81
C
car racing. See Drive She Said game casual games, 329–31. See also Color
Drop game; Dice Battle game classes package, 48
collision detection,
for Balloon Saw game, 28–29 for Blaster Mines game, 557 for Flak Cannon game, 196-203 for Pixel Shooter game, 41-42 tile-based
for Drive She Said game, 414, 431-32, 466-69
for No Tanks! game, 260, 316–17 Color Drop game, 331–64
assets, 333–34 blocks
adding, 350–52 class for, 336–40
click events for, 340, 353–58 graphics for, 333
removing, 358–61
testing for connections, 355–58 updating, 352 designing, 331 difficulty levels, 341, 362–63 ending, 362–63 game structure, 342–44 initializing, 345–46 Main class, 334–36 sounds, 333 state constants, 341 state machine, 347–50 testing, 364
complex custom events, 103
constructor for game. See game constructor contests for games, 575
copyright, 365–66 core gaming, 330 countdown clock, 429–31
D
debugging, 7 design patterns, 45design specification, 100-105 designing games
Blaster Mines game, 478 Color Drop game, 331 Dice Battle game, 369–70 Drive She Said game, 407–10 Flak Cannon game, 139 No Tanks! game, 207 Super Click game, 100–105 Tunnel Panic game, 598–600 Dice Battle game, 369–405
assets, 371–72 characters, 371, 384 computer player, 379, 389–90, 395–400 designing, 369–70 dice, 371, 379–83 dice click events, 383 difficulty levels, 379, 401, 405 ending, 401
Game.as class, 385–89 graphics, 371–72 Main.as class, 375
player moves, capturing, 392–94 scoreboard, 373, 392–94 sounds, 372, 374–75 state constants, 385 state machine, 390–91 testing, 405 difficulty levels
array of classes for, 341, 362–63 for Color Drop game, 341, 362–63 for Dice Battle game, 379, 401, 405 for Flak Cannon game, 152-54, 183,
187, 203-4, 206 level data for, 240–43 level in screen for, 47, 95 level maps for, 216–21 setting, 67, 81
for Super Click game, 101, 102, 103, 115, 117–19, 126
in tile sheets
Drive She Said game, 415–16, 425–26, 437–39, 449, 471 No Tanks! game, 207, 210–16,
230–33, 306, 310, 320, 327 for Tunnel Panic game, 603 variables controlling, 102, 115 Digg.com web site, 572
dirty rect erase, 602
distributing viral web games, 572–74
Distribution service, Adobe Flash Platform, 579
Drive She Said game, 407–72 assets, 427–29 buffering, 412, 435 camera, 412, 434–35, 463 car moving, 416–18, 432–34, 453–57, 458–62 rendering, 462–65 restarting, 452 collision detection, 414, 431–32, 466–69 countdown clock, 429–31 designing, 407–10 difficulty levels, 415–16, 425–26, 437–39, 449, 471 directional keypresses, 442 frame rate, 426 Game class, 439–70 hearts, adding, 427 initializing, 445–47 Main.as class, 420–26 output canvas, 412–13, 435 project, creating, 418–20 scoreboard, 424 screen, rendering, 462–65 sounds, 424, 443 sprites, 413–14 starting, 447–52 state machine, 442, 445, 457 testing, 471
tile sheet for, 410-13
tile-based blit scrolling, 411, 453–57
E
eCPM (effective Cost Per Mille), 575 encapsulation, 8
encryption for games, 580 ending games, 66, 94
Balloon Saw game, 30 Color Drop game, 362–63 Dice Battle game, 401 Flak Cannon game, 205 No Tanks! game, 320 Super Click game, 126 Tunnel Panic game, 604 engine. See game engine error handling, 7
event model, 7, 11, 13–16, 103-4 events, 47, 68–69
examples
Balloon Saw. See Balloon Saw game Blaster Mines. See Blaster Mines game Color Drop. See Color Drop game Dice Battle. See Dice Battle game Drive She Said. See Drive She Said
game
Flak Cannon. See Flak Cannon game No Tanks!. See No Tanks! game Pixel Shooter. See Pixel Shooter game space shooter. See space shooter game stub game using framework, 89–98 Super Click. See Super Click game Tunnel Panic. See Tunnel Panic game exclusive licenses, 577
F
Facebook, distributing viral web games on, 573
finite state machine. See state machine Flak Cannon game, 137–71, 173–206
animated sprites, 166–71 assets accessing, 144–47 adding, 140–44 bonus planes, 192 collision detection, 196–203 crosshairs, 184–86 designing, 139 difficulty levels ending, 203–4 improving, 206 setting, 152–54, 187 starting, 183 ending, 205 enemies, creating, 189–92 game constructor, 182 game-specific code, 176–87 graphics, 140–42 mouse events, 184–86 possible improvements, 206 removing objects from screen, 196 rendering moving objects, 203 ships, 186–87 sound manager, 147–52, 174–76 sounds, 143–44, 177, 179 state loop, 173, 188–205 static sprites, 155–66 testing, 188 updating objects, 194–96
Flash Builder (Flex Builder) creating projects, 52 requirements for, 7 Flash Develop creating projects, 51, 222, 419, 583 file structure, 107, 113, 222 projects, creating, 499 Flash IDE accessing graphics, 145 accessing sounds, 147 adding assets, 232 creating projects, 50, 105, 221, 419, 582 file structure, 107, 113 package structure, 49 preloading games, 587–95 projects, creating, 498 requirements for, 7 testing games, 16, 22 FlashGameDistribution.com, 578 FlashGameLicense.com, 578 Flex Builder. See Flash Builder Flex SDK accessing graphics, 146 accessing sounds, 147 adding assets, 231 file structure, 107, 113, 222, 231 package structure, 50 preloading games, 584–87 FlyWrench game, 477
frame rate profiler, 485–92, 507–8 frame rate, monitoring, 493–97 frame timer tick, 52, 426
framework. See game framework free-form tile-based movement, 410–13 full-screen blit, 235, 237
function reference pattern, 52 functions (methods), 8
G
Galaga Legions game, 477 game constructor
for Balloon Saw game, 24 for Flak Cannon game, 182 for space shooter game, 14 for Super Click game, 116–17 game contests, 575 game engine, 8 game framework, 8–16, 45–47, 88, 174–76, 562–69 background, 63 basic screen, 46, 47, 70–73
game framework (continued)
design patterns in, 45 events, 47, 68–69
frame rate profiler, 485–92, 507–8 game timer, 46, 52, 61, 63, 68, 95 mute functionality, 481, 506, 509 package structure, 48–50 pause functionality, 481, 506 scoreboard, 46, 47, 62, 82–88, 90, 93 simple button, 46, 47, 74–81 state constants, 46, 53–54 state functions, 46, 54–55, 65–68 state machine, 46, 52, 64
time-based step timer, 482–85, 507, 552-54
using, example of, 89–98 variable defintions, 60–63 game loop. See state loop
game portals, distributing viral web games on, 573
game timer, 11, 46, 52, 61, 63, 68, 95 for Balloon Saw game, 26 for No Tanks! game, 266–67 for space shooter game, 12 time-based step timer, 482–85, 507,
552-54
Gamer Blips web site, 572 GamerSafe.com web site, 578 games
ads in, 575
casual games, 329–31
designing. See designing games difficulty levels for. See difficulty levels ending. See ending games
examples of. See examples
finishing development, importance of, 3, 5
iterative development process, 3–5, 254 legal issues regarding, 365
licenses for, 576–79 post-retro games, 473-78 preloading, 584–95
projects for. See projects, creating reasons for developing, 5
sponsorships for, 576–79 testing, 16, 22, 37, 98 viral web games, 571–82 GAS (GotoAndStop) scrolling, 411 Geometry Wars game, 476 GIMP tool, 212–16
golden rule of intellectual property, 368–69
Google Ad Sense, 575 graphics
accessing with Flash IDE, 145–46 accessing with Flex SDK, 146 for Balloon Saw game, 17–18 for Color Drop game, 333 creating with GIMP tool, 212–16 for Dice Battle game, 371–72 for Flak Cannon game, 140–42 for Pixel Shooter game, 31 Spritelib GPL library, 140–42, 209
See also assets; sprites grid format. See tile sheets
H
hardcore games, 329 hardware blitting, 234 hardware sprites, 234
I
image tiles. See tile sheets
individual object blitting, 235, 236, 237 in-game ads, 575
inheritance, 9 in-page ads, 575
intellectual property law, 365–69 iterative process of game development,
3–5, 254
L
leader boards, Mochi, 595–98 legal issues for game
development, 365–69 levels. See difficulty levels library assets. See assets licenses for games, 576–79 look-up tables, 514–16
M
Mappy map editor, 216–21 marketing viral web games, 580 match-three games, 331
maze games. See No Tanks! game memory conservation, 510, 514 memory usage, monitoring, 493–97 methods. See functions
microtransactions, 576 minimax AI, 395–400
Mochi Media, 575
Mochi preloader ads and leader boards, 595–98 MP3 silence space, 428 muting games, 481, 506, 509
N
No Tanks! game, 207–50,253-330 assets, 209–11, 231–33, 305 background, 217, 219, 246–48, 304 collision detection, 260, 316–17 creating project, 221–23 designing, 207 difficulty levels, 207, 210-16, 230-33, 306, 310, 320, 327 ending, 320 enemy tanks adding, 282–86 moving, 286–300 explosions, 324 game timer, 266–67 GameDemo.as class, 226–30, 243–50 keypress logic, 268 levels in, 306, 310, 320, 327 Main.as class, 300–304 missiles, firing, 321–23 NoTanks.as class, 307–25 performance, 236–38, 250 players adding, 260–65move states of, 267, 269–76 moving, 266–81 restarting, 263, 311 regions in, 283–85 scoreboard, 304 sounds, 304–6 testing, 326
tile sheets in. See tile sheets variables, 243, 308
nonexclusive licenses, 577 n-way movement. See free-form
tile-based movement
O
obfuscation, 580 object model, 9 object pooling, 510–13
object-oriented (OO) methodology, 8–11
object-oriented state machine, 52
objects
animated, 521–30
collisions between, detecting, 28–29, 41–42
creating at random frequency, 27 moving, 28, 194–96, 203 multiple, tracking, 39
new, starting in motion, 189–92 removing from screen, 196 updating, 194–96
See also sprites
OO (object-oriented) methodology, 8–11
optimization
look-up tables, 514–16 object pooling, 510–13 for radar screen, 517
for screen-based blit scrolling, 516 single-unit processing, 513
See also performance
P
package structure, 48–50 packages, 8 Pac-Man CE game, 476 patents, 367 pausing games, 481, 506 performance of AS3, 7 of blitting, 236–38 of object creation, 250 recursive functions and, 355See also optimization Pixel Shooter game, 31–42
assets, 31–32 code, 32–37 collision detection, 41–42 explosions, 42 firing missles, 40 graphics, 31 sounds, 32 state loop, 38 testing, 37
tracking multiple objects, 39 variables, 38
PMGs (Player Missile Graphics), 233 pooling objects, 510–13
portals, distributing viral web games on, 573, 574
post-retro games, 473–78. See also Blaster Mines game
preloader ads, Mochi, 595–98 preloading games, 584–95 prior art, 368
projects package, 48–50 projects, creating, 48-52
Blaster Mines game, 498-500 Drive She Said game, 418–20 No Tanks! game, 221–23 Super Click game, 105–6 Tunnel Panic game, 582–83 properties. See variables
puzzle games. See casual games
R
radar screen, 517 recursive functions, 355
Retro Game Challenge game, 477 retro games. See post-retro games
S
scoreboard, 46, 47, 62, 82–88, 90, 93 for Balloon Saw game, 25 for Blaster Mines game, 505 for Dice Battle game, 373, 392–94 for Drive She Said game, 424 for Super Click game, 102, 110, 124 screen definition variables, 62
screen invalidation, 234
scrolling tile sheets. See tile scrolling second game theory, 3, 4
security for viral web games, 579–80 SFXR program, 143–44
Shibuya service, Adobe Flash Platform, 579 simple custom events, 103
simple events, 47 single-player games, 329 single-unit processing, 513 site locking, 579
smooth tile-to-tile movement, 255 social gaming sites, distributing viral web
games on, 573
social news sites, distributing viral web games on, 572
Social service, Adobe Flash Platform, 579 software requirements, 7
sound manager, 147–52, 174–76 sounds
accessing from library, 147 for Balloon Saw game, 18 for Color Drop game, 333
for Dice Battle game, 372, 374–75 for Drive She Said game, 424, 443 for Flak Cannon game, 143–44, 177,
179
MP3 silence space, 428 muting, 150, 481, 506, 509 for Pixel Shooter game, 32 SFXR program, 143–44
for Tunnel Panic game, 587–92, 609
Seealso assets soundtrack, 149–51 Space Giraffe game, 476
Space Invaders Extreme game, 477 space shooter game, 9–17
event model, 13–16 game constructor, 14 game timer, 12 object model, 9 state loop, 11–12 testing, 16
sponsorships for games, 576–79 sprite sheets, 235. See also tile sheets Spritelib GPL library, 140–42, 209, 413 sprites, 234
animated, 166–71
blocks as, in Color Drop game, 333 circles as, in Super Click
game, 127–31
in Drive She Said game, 413-14 hardware sprites, 234
moving between two points, 155–61 moving on continuous
vector, 161–66 rendering, 234, 257–58
ship as, in Tunnel Panic game, 600, 601–3 static, 155–66 in tile sheets, 212, 218–19, 220 adding, 255–57, 260–65 moving, 254–55, 258–60, 266–81 stage, scrolling, 411 state constants, 46, 53–54 state control variables, 61 state functions, 46, 54–55, 65–68 state loop, 11
for Balloon Saw game, 25 for Blaster Mines game, 552-54 for Flak Cannon game, 173,
188–205
state loop (continued)
for space shooter game, 11–12 for Super Click game, 119–22 state machine, 46, 52, 64 static sprites, 155–66 stub, 48
Super Click game, 99–133 background, 110 circles adding, 121 defining, 127–31 fading out, 124 removing, 122, 130 updating, 121, 130 creating project, 105–6 design specification, 100–105 difficulty levels ending, 103, 126 setting, 117–19 specifying, 101 variables controlling, 102, 115 ending the game, 126
events, 103–4 Game class, 113–27 game constructor, 116–17 Main.as class, 106–13 scoreboard, 102, 110, 124 scores, in circles, 121, 122, 131–33 state loop, 119–22 testing, 133 variables, 101, 115 SWF encryption, 580
T
technical design specification, 100–105 testing games, 16, 22, 37, 98
Tetris game, 330 tick. See frame timer tick tile jumping, 254 tile scrolling, 410–13 tile sheets, 209–11, 235
blitting, 233, 234, 235–38 creating, 212–16
dynamic movement in, 208 free-form movement in, 410–13
hard-coded movement logic in, 207, 259 layers in, 217–21
level data for, 240–43 level maps for, 216–21
levels in
Drive She Said game, 415–16, 425– 26, 437–39, 449 No Tanks! game, 207, 210–16, 230– 33, 306, 310, 320, 327 sprites in, 212, 218–19, 220 adding, 255–57, 260–65 moving, 254–55, 258–60, 266–81 XML data for, 223–30
tile-based blit scrolling, 411, 453–57 tile-based collision detection, 260 TileSheet class, 238–50
tile-to-tile movement, smooth, 255
time-based step timer, 482–85, 507, 552-54 timer tick. See Frame timer tick
timer variables, 61 title screen, 65, 93 trademarks, 366
Tunnel Panic game, 582–619 assets, 587–92, 609 creating project, 582–83 designing, 598–600 difficulty levels, 603 ending, 604 Game.as class, 605, 610–19 Main.as class, 592–95, 605–9 obstacles, 601 play field, 601 player ship, 600, 601–3 preloader ads and leader
boards, 595–98 preloading, 584–95 sounds, 587–92, 609 testing, 619
Twitter, distributing viral web games on, 572 two-dimensional arrays, 210
V
variables, 8, 24
for game difficulty, 102, 115 for game framework, 60–63 for game logic, 101, 115 viral web games, 571–82
distributing, 572–74
making money from, 575–79 marketing, 580
post-retro games as, 478 security for, 579–80 web site resources, 581
W
wait variables, 63 web sites
about viral web games, 581 distributing viral web games on, 572 site locking, 579
X-Y-Z
XML data
creating, 223–25 reading, 225–30 for tile sheets, 223–30 Yahoo Buzz web site, 572 zero-relative arrays, 210