Game Development Reference
In-Depth Information
Figure 9-12 . I killed the boss, and I can't see a darn thing. But those particles are so beautiful!
In the Enemy class, the gotHit method is the perfect place to add destructive particle
explosions, as Listing 9-5 shows. I decided the boss monster should have its own
particle effect, mostly because it's so big. And purple.
Listing 9-5 . Adding an Explosion Effect to the Shoot 'em Up Game
-(void) gotHit
{
hitPoints--;
if (hitPoints < = 0)
{
self.visible = NO;
// Play a particle effect when the enemy was destroyed
CCParticleSystem* system;
if (type == EnemyTypeBoss)
{
system = [CCParticleSystemQuad particleWithFile:@"fx-explosion2.plist"];
[[SimpleAudioEngine sharedEngine] playEffect:@"explo1.wav"
pitch:1.0f
pan:0.0f
gain:1.0f];
}
else
 
 
 
Search Nedrilad ::




Custom Search