Game Development Reference
In-Depth Information
if (player.hitTestObject(goalSprite)) {
dispatchEvent(new CustomEventSound(CustomEventSound.PLAY_SOUND,
Main.SOUND_GOAL, false, 1, 0));
dispose(goalSprite);
score += scoreGoal;
goalReached = true;
playerInvincible = true;
}
var ammoPickupLength:int = ammoPickupList.length - 1;
for (ctr = ammoPickupLength; ctr >= 0; ctr--) {
tempPickup = ammoPickupList[ctr];
pickupHitPoint.x = tempPickup.x;
pickupHitPoint.y = tempPickup.y;
if (tempPickup.bitmapData.hitTest(pickupHitPoint, 255, player.bitmapData,
playerHitPoint)){
ammoPickupList.splice(ctr, 1);
dispose(tempPickup);
ammo += ammoPickupAmount;
dispatchEvent(new CustomEventSound(CustomEventSound.PLAY_SOUND,
Main.SOUND_PICK_UP, false, 1, 0));
}
}
var lifePickupLength:int = lifePickupList.length - 1;
for (ctr = lifePickupLength; ctr >= 0; ctr--) {
tempPickup = lifePickupList[ctr];
pickupHitPoint.x = tempPickup.x;
pickupHitPoint.y = tempPickup.y;
if (tempPickup.bitmapData.hitTest(pickupHitPoint, 255, player.bitmapData,
playerHitPoint)){
lifePickupList.splice(ctr, 1);
dispose(tempPickup);
lives += 1;
dispatchEvent(new CustomEventSound(CustomEventSound.PLAY_SOUND,
Main.SOUND_LIFE, false, 1, 0));
}
}
}
Search WWH ::




Custom Search