Game Development Reference
In-Depth Information
In the preceding function, we are drawing a rectangle on the target location vec-
tor. Whenever the player is inside this rectangle, it's not safe. So, it will flee to get
the player outside into the safe location. So, we will execute our evade function
till the player is in the rectangle.
4. Now, it's time to test the evade function we have written in Player.m . So, open
the GameScene.m file. Enter the following line of code:
behaviourType = Arrive;
Then, replace this with the following line of code:
behaviourType = Evade;
5. The final init method should look something similar to the following screen-
shot:
Search WWH ::




Custom Search