Game Development Reference
In-Depth Information
if (self.behaviourType == Wander) {
[self wanderWithDeltaTime:deltaTime];
}
The final
update
function should look something similar to the following
screenshot:
3. Now, it's time to test the
evade
function we have written in
Player.m
. So,
open the
GameScene.m
file and add the following line of code:
behaviourType = Evade;
Then, replace it with the following line of code:
behaviourType = Wander;
Also, add the following if condition right after the if we had for the seek and flee: