Game Development Reference
In-Depth Information
Figure 3-15. Touch rule
You can access to this stage by opening the file MyFirstPong_step10.gameproj .
Giving Your Game a Brain
iOS devices are powerful but implementing artificial intelligence with GameSalad
is not possible. However, with a little bit of imagination, you can implement a
few rules and behaviors that can do the trick.
You will proceed in a two-stage implementation. You will detect when the ball is
coming to the Player 2 racket; when it passes half the screen, you will collect the
y-value of the ball and store the value into an attribute. You will use a second
attribute to limit the racket movement. The second stage will be to move the
racket to this value.
Detecting the Direction and Getting the Y Value
1. Create a real attribute and name it ''predict.''
2. Create a Boolean attribute and name it ''positionyourself'' with a
default value of false (leave it unchecked).
3. Open the Ball actor in the Actor Editor.
 
Search WWH ::




Custom Search