Game Development Reference
In-Depth Information
tempMissile.dx = -1*enemyShotSpeed;
tempMissile.dy = 0;
break;
}
tempMissile.nextX = tempMissile.x;
tempMissile.nextY = tempMissile.y;
enemyMissileList.push(tempMissile);
addChild(tempMissile);
dispatchEvent(new CustomEventSound(CustomEventSound.PLAY_SOUND,
Main.SOUND_ENEMY_FIRE, false, 1, 0));
}
}
Changing the readBackGroundData function
Make sure the ReadBackGroundData function has a line for each of the five level-specific data
variables from the Level class subclasses. Here is the entire function for reference, but the five
variables to add are indicated in bold in the code:
private function readBackGroundData():void {
levelTileMap = [];
levelData = levels[level];
levelTileMap = levelData.backGroundMap;
//*** The five new variables
enemyIntelligence = levelData.enemyIntelligence;
enemyShotDelay=levelData.enemyShotDelay;
enemyShotSpeed = levelData.enemyShotSpeed;
enemyHealthPoints = levelData.enemyHealthPoints;
ammoPickupAmount=levelData.ammoPickUp;
}
Changing the readSpriteData function
The readSpriteData function needs to be updated to handle the sprite types we have not added
yet. Also, there are a couple lines for the enemy sprites that need to be uncommented.
First, uncomment these lines in the case SPRITE_ENEMY section:
empEnemy.missileDelay = enemyShotDelay;
tempEnemy.healthPoints = enemyHealthPoints;
Here is the entire new case for SPRITE_ENEMY for reference:
case SPRITE_ENEMY:
tempEnemy = new TileByTileBlitSprite(tileSheet, enemyFrames, 0);
tempEnemy.x=(colCtr * tileWidth)+(.5*tileWidth);
tempEnemy.y = (rowCtr * tileHeight) + (.5 * tileHeight);
tempEnemy.currRow = rowCtr;
tempEnemy.currCol = colCtr;
setCurrentRegion(tempEnemy);
tempEnemy.currentDirection = MOVE_STOP;
tempEnemy.animationLoop = false;
Search WWH ::




Custom Search