Game Development Reference
In-Depth Information
Click the Attribute tab in the inspector in Scene Editor mode. Then click the +
sign to create a new attribute and select integer. The initial value should be 0
and the type should be integer as per Figure 5-6.
Figure 5-6. NumberCarrots attribute
Setting the Screenplay: Implementing Rules and
Behaviors
You need to define the logic of your game and you will use rules and behaviors
to accomplish this task. You will use the Timer and Accelerator behaviors to
create controls and the auto firing.
Carrots: The Ultimate Enemy Role
Drag and drop a Change Attribute behavior into the Carrots actor and change
game.NumberCarrots to game.NumberCarrots+1 as per Figure 5-7. Every time
you position a Carrots actor on the scene, this will increment by 1 the attribute
NumberCarrots. So when you start the scene, you will have the number of
carrots on the screen contained in the game attribute NumberCarrots.
Figure 5-7. Change Attribute NumberCarrots
Now create a rule that will detect when a collision occurs between a bullet and a
carrot, trigger a decrement of the number of enemies, and then destroy the
enemy.
 
Search WWH ::




Custom Search