AI a little question
giovanni-caglio
Member Posts: 6
hi I was reading this post
https://forums.gamesalad.com/discussion/45621/ai-for-enemies-in-a-platform-game
I done what MobileRocketGames writed but i want that when the enemy catch the player doesn't stop but continue to follow the player
can you help me? thanks (i'm not english sorry for any errors)
Comments
I would try something like this.
Create a boolean Game attribute "follow" and set to false.
Create an integer Game attiribute "playerX
Create an integer Game attribute "playerY"
Now go to player actor and create a rule "When follow is true"
constrain attribute player.position.X to Game.playerX-20
constrain attribute player.position.Y to Game.playerY-20
Then create a rule for the enemy actor. When actor collides with actor "player"
change attribute Game.follow to true
Finally create another rule for the enemy actor. When follow = true
constrain attribute enemy.position.X to playerX
constrain attribute enemy.position.Y to playerY
This should help get you started. Experiment with behaviors! You can do it!
I'm not familiar with the post you link too, but maybe this video will help?
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page