Game Development Reference
In-Depth Information
Click Create Rule and name the rule ''Destroy the Carrot.'' Add the following
conditions: ''Actor receives event'' ''overlaps or collides'' with ''actor of type''
''Bullet.'' Drag and drop a Timer behavior and change the setting to ''After'' ''0.4''
seconds. Check the box for ''Run to Completion.'' Then drag and drop a
Change Attribute behavior and change game.NumberCarrots to
game.NumberCarrots-1. Lastly, drag and drop a Destroy behavior as per
Figure 5-8.
Why are you using a Timer? Later in this chapter you will implement an
explosion effect with a duration of 0.4 seconds. Thus the timer is to give you the
time to display this effect before destroying the actor.
Figure 5-8. Destroy the Carrot rule
Flying the Spaceship
First, you will ensure that the spaceship stays on a horizontal axis at Y=25 by
using a Constrain Attribute behavior.
Drag and drop a Constrain Attribute behavior into the Spaceship actor and
configure spaceship.position.Y to 25 as per Figure 5-9.
 
Search WWH ::




Custom Search