Game Development Reference
In-Depth Information
Figure 3-2. Self-increment of P2 score
Now you can keep track of the Player 2 score. Repeat the same steps to keep
track of the Player 1 score.
Create a new actor and change the following attributes:
Name: Right Winning Zone
Size/Width: 10
Size/Height: 320
Color/Alpha: 0
Physics/Density: 0
Physics/Moveable: Unchecked
Next, add a rule to detect the overlap between this zone and the ball. Create a
rule and name it Ball Detection rule. The rule is ''Actor receives event'' and
''overlaps or collides'' with actor of type ''ball.''
Drag the Change Attribute behavior into the rule. The behavior is Change
Attribute: game.P1 Score. Use the Expression Editor to self-increment by 1 the
Player 1 score.
Go back to the Scene View Editor. Drag and place the Left Winning Zone on the
complete left side of the visible zone, as shown in Figure 3-3.
 
Search WWH ::




Custom Search