Android gaming, 3
Angry Birds/World of Warcraft, 6
collaborative environment, 7
2-D and 3-D game development, 10
development tools
IDE, 10
SDK download and install, 12
familiarity and lack of power, 4
full-time game developer, 6
game-development companies, 6
Java packages, 3
recoding, 7
RPG, 5
SDK, 4
Star Fighter game, 5
story writing, 10
game play details, 9
Spy Hunter, 8
well-formatted Microsoft Word document, 7
version selection, 14
Android ImageView, 74
Background rendering
bitmap, 74
3-D effect, 74
finished backgrounds, 74
game activity, 75
GLSurfaceView, 79
image loading
backgroundstars.png, 86
2-D graphics, 86
draw() method, 96
loadTexture() method, 90–92, 95, 96
Motorola Droid model phone, 86
R.java file, 86
res/drawable-[density] folders, 86
res/drawable-nopi folder, 86
SFBackground.loadTexture() method, 87
vertices, textures, and indices, 88–90
onDrawFrame() method, 80
onResume() and onPause(), 77, 79
onSurfaceChanged() method, 80
OpenGL Surface creation, 80–82
quick thread pausing routine
GLSurfaceView renderer, 113
main menu, 117
onDrawFrame() method, 113
SFEngine, 113
scrolling, 74
bgScroll1, 98
matrix modes, 99
scrollBackground1() method, 97
texture transformation, 101, 103, 104
bgScroll1 and bgScroll2, 105
cumulative scrolling factor, 105
debris.png, 104
float constant, 104
game-specific code, 105
loadTexture() method, 104
scrollBackground2() method, 111, 112
SFGame.java, 75
SFGameRenderer, 79
Bezier Curve
Cartesian points, 170
enemies class, 175
getNextScoutY() method, 171
left-hand side attacking, 172
quadratic, 170
SFEnemy() class, 171
SFGoodGuy class, 172
Star Fighter game, 170
t factor, 170
x axis value, 170
y axis value, 170
BHCorridor class
arbitrary texture, 275
BHGameRenderer.java file, 284
Blob Hunter project, 274
3-D corridor, 274
drawCorridor() method, 284
gluLookAt(), 284
wall texture addition, 283, 284
BHWalls class
code segment, 272
glTranslatef(), 272
OpenGL, 273
square wall shape, 271
unobstructed 360-degree view, 272
unobstructed portions, 271
Blob Hunter, 287
Blob Hunter 3-D game
BHGameView, 257
BHWalls class
BlobhunterActivity.java, 256, 257
constant creation, 260
drawable-nodpi folder, 260
drawBackground() method, 267–269
glOrthof() method, 265
gluPerspective() method, 266, 267
key parts, 256
loadTexture() method, 264
scout image, 260
Character creation, 119
character moving method, 143
GL10, SFGameRenderer, 132
glScalef() function, 133
goodGuyBankFrames increment, 141
if else statement, 142
matrix model view, 134
movePlayer1() method, 133
PLAYER_RELEASE action, 136–138
playerBankPosX variable, 134
right-banking animation, 148–150
second frame, animation, 143, 145, 146
switch statement, 133
FPS delay adjustment, 156, 157
loading a texture
PLAYER_BANK_LEFT_1, 129
PLAYER_BANK_LEFT_2, 129
PLAYER_FRAMES_BETWEEN_ANI, 129
PLAYER_RELEASE, 129
player's ship, 130
playerFlightAction variable, 127–129
SFGameRenderer.java file, 131
sprite animation
flip-book style effect, 120
glTranslateF() function, 121
Mario Brothers, 120
OpenGL render, 121
sprite sheet, 121
Star Fighter, 120
textures, 120
time-honored tools, 119
texture mapping arrays
draw() method, 124
full texture mapping, 124
loadTexture() method, 126, 127
touch event
ACTION_UP and ACTION_DOWN trapping, 154–156
onTouchEvent() listener, 151, 152
SFGame.java, 151
two-layer background scroll, 119
verticesarray, 123
3-D environment navigation
BHGameRenderer.java, 292
camera system, 291
control interface
BHEngine editing, 288
onTouchEvent() method, 288
Star Fighter, 287
corridorZPosition variable, 292
drawCorridor() method, 292
forward motion, 292
matrix multiplication, 291
OpenGL built-in tools, 291
player view adjustment, 293, 294
playerRotate variable, 292
switch case statement, 292
3-D first-person gaming, 272
2-D Star Fighter, 287
Enemy artificial intelligence
enemies[] array loop, 185, 186
enemyType property, 186
interceptor
players position locking, 189–191
Star Fighter, 187
moveEnemy() method, 185
scout, 198
SFGameRenderer(), 177
sprite sheet loading, 183, 184
spriteSheets[] array, 178
TOTAL_INTECEPTORS, 177
TOTAL_SCOUTS, 177
TOTAL_WARSHIPS, 177
Enemy class
common sprite sheet, 165
creation, 164
2-D gaming, 165
SFEnemy class creation
attack direction, 166
ATTACK_LEFT, 167
ATTACK_RANDOM, 167
ATTACK_RIGHT, 167
Bezier curve, 170
case statement, x-axis starting point, 169
constructor, 167
indication, 167
interceptor, locks, 168
posT, 169
scrolling shooters, 168
SFEnemy(), 166
SFEngine creation, 168
swift, predictable pattern, 168
TYPE_INTERCEPTOR, 167
TYPE_SCOUT, 167
TYPE_WARSHIP, 167
warship maneuvers, random pattern, 168
x and y positioning, 166
SFEnemy() package, 166
SFEngine class, 165
Frames per second (FPS) delay, 156, 157
Game publishing
AndroidManifest file, 243, 244
icon, 244
keystore
apk file, 251
4-bit boundaries, 252
destination and key/certificate checks window, 251, 252
project selection window, 247, 248
sign, align, and release, 244, 246, 247
versionCode and versionName, 244
Integrated development environment (IDE), 10
Java class transformation
Android activity, 30
AndroidManifest.xml, 30
application nodes section, 31
menu activity, 34
name attribute selector, 33
new element creation, 31
quick review, 34
screen orientation setting, 34
SFMainMenu activity, 32
snippet XML code, 31
StarfighterActivity, 33
Motorola Droid model phone, 86
moveEnemy() method, 205
onDrawFrame() method, 205
OpenGL graphics, 13
OpenGL standard, 74
Role-playing game (RPG), 5
SFGame.java, 75
Silicon Graphics, 12
Software development kit (SDK), 4
Splash screen
benefits, 37
dragging image, 37
fade effects creation
accelerate_interpolator, 46
alpha animation, 46
android:duration property, 46
android-fromAlpha and android-toAlpha properties, 47
animation, 45
decelerate_interpolator, 47
fadein.xml file, 45
fadeout.xml file, 45
interpolator, 46
game threading
Android activities, architecture, 48
processor-intensive, 48
running games, 48
image importing, 36
layout file creation
FrameLayout, 40
image display, 38
StarfighterActivity connection, 43–45
XML file editing, 39
nine-patch graphics, 36
nine-patch screen, 35
Sprite sheet
adding, SFEngine class, 165
common sprite sheet, 165
2-D gaming, 165
good_guy sprite sheet, remove, 165
midgame housekeeping, 159, 160
SFEnemy class creation
attack direction, 166
ATTACK_LEFT, 167
ATTACK_RANDOM, 167
ATTACK_RIGHT, 167
Bezier curve, 170 (seealso Bezier Curve)
case statement, x-axis starting point, 169
constructor, 167
indication, 167
interceptor, locks, 168
posT, 169
scrolling shooters, 168
SFEnemy(), 166
SFEngine creation, 168
swift, predictable pattern, 168
TYPE_INTERCEPTOR, 167
TYPE_SCOUT, 167
TYPE_WARSHIP, 167
warship maneuvers, random pattern, 168
x and ypositioning, 166
SFEnemy(), 166
Star Fighter, 187
Star Fighter 2D arcade shooter, 27
Android platform, 27
main menu creation
button images adding, 54
exit button rest state, 54
layout folder, 55
layout_width and height properties, 55
pressed state exit button, 55
pressed state start button, 54
RelativeLayout layout, 55
start button, rest state, 54
music
AndroidManifest, 69
background music, 61
housekeeping function, 61
musicThread(), 69
onCreate() method, 66
raw folder, 62
SFMainMenu.java, 70
SFMusic service, 69
SPLASH_SCREEN_MUSIC, 63
variable, R_VOLUME and L_VOLUME, 63
warfieldedit.ogg, menu, 63
screen, 28
splash screen
activity creation, 28
game main menu, 28
Java class transformation (see Java class transformation)
new Java class creation, 29
programe building, 27
AF-718, 15
Captain John Starke, 15
game creation, 18
game details, 17
game-specific code, 20, 22, 23
Kordark Interceptors, 16
Kordark invasion fleet, ships, 16
Kordark Scouts, 16
Larash War Ships, 16
new Android project wizard, 24
Star Fighter engine, 23
"Use default location" check box, 26
Texture class
glBindTextures() method, 163
glGenTextures() method, 162
loadTexture() method, 160
SFBackground() class, 162
SFGameSFGameRenderer() class, 164
SFTextures(), 161
textureNumber parameter, 163
Weapon
collision detection
applyDamage() method, 222
detectCollisions() Method, 220, 221
2-D collision detection, 207
firePlayerWeapons() method, 214, 215, 218, 219
screen, edge detection, 215–218
SFWeapon() array, 211
INTERCEPTOR_SHIELDS constant, 208
PLAYER_BULLET_SPEED constant, 208
SFEngine.java file, 208
SHOUT_SHIELDS, 208
space-fighting weapon, a blaster, 207
WARSHIP_SHIELDS constant, 208
WEAPONS_SHEET constant, 208
18.119.117.207