Game Development Reference
In-Depth Information
An Explosion of Colors
Before playing a little bit with the Particles behavior, you need to follow a few
additional steps in your gameplay.
Open Soft Block in the Actor Editor and create a new integer actor attribute
named ''NbHit'' with a default value of 0. This attribute will increment itself by
one for each collision with the projectile.
Create a new rule named ''Collision Increment.'' The condition of the rule is
''Actor receives event'' ''overlaps or collides'' with ''actors of type'' ''Projectile.''
Then drag and drop a Change Attribute behavior into the rule and change Soft
Block.NbHit to Soft Block.NbHit+1.
Next, create a second rule named ''Block Destruction.'' This rule will destroy the
actor after two hits from the projectile. The condition of the rule is
''Attribute''''Soft Block.NbHit''''≥''''2.'' Then drag and drop a Destroy behavior
into the rule.
The Actor Editor view of Soft Block is shown in Figure 7-11.
Figure 7-11. Actor Editor view of Soft Block
Repeat the same for the Hard Block actor, but instead of two hits required to
destroy the actor, set it for destruction after three hits. The actor is shown in
Figure 7-12.
 
Search WWH ::




Custom Search