Game Development Reference
In-Depth Information
Figure 3-8. Destroying the ball
You can open the file MyFirstPong_step7.gameproj to access to the current
stage of the design.
It's All About the Ace!
Are you ready to ace the game? Before starting the competition, you need to
create two additional features of the game: winning points and serving the next
ball.
At this point, not only can Player 1 serve but he can serve an infinite number of
balls into the game at the same time. Press the space bar multiple times if you
don't believe me.
Serving Feature: The Winner of the Point Serves the
Next Ball
Implementing the function ''the one who makes the point will serve the next ball''
is fairly easy, especially because you have set up almost everything already. As
you only have two players in the game, it can only be Player 1 or Player 2 who is
serving. Another way of saying this is that Player 1 is serving or not (if not, then
Player 2 is serving).
In the previous chapter, you created an attribute for serving that you will reuse
now. The attribute P1Serving will get modified according to which player makes
the points.
Open the Left Winning Zone actor in the Actor Editor by double-clicking it. You
already have a rule that makes the scoring point. Add a Change Attribute to this
existing rule to modify the P1Serving attributes in addition to the score. The rule
detects when Player 2 makes the point. In that case, it's Player 2's turn to serve.
Thus, P1Serving should be set to false.
 
Search WWH ::




Custom Search