Game Development Reference
In-Depth Information
Figure 3-11. A new Boolean attribute
Name this attribute ActiveBall and leave it unchecked, as initially there will be no
ball in the game.
Let's go back to the spawning behavior. Remember, the ball is spawned but the
rackets are spawning. So you need to modify the behavior of the racket actors.
Open Rack Player 1 and add a new condition in the Serving rule. The condition
is if game.ActiveBall is false. Then you need to add a Change Attribute behavior
that will occur at the same time as the ball spawning. Drag a Change Attribute
below the Spawn actor and implement game. ActiveBall to 1. This will change
the attribute to true, preventing a new ball from being spawned when the space
bar is down. Figure 3-12 shows the modified Serving rule.
Search WWH ::




Custom Search