Hi, i am trying to make a platform game with an enemy ai that will try to walk/jump to you and attack you on contact, and for bosses possibly shoot at you. I am really not sure how to do this as there are literally no tutorials on it. Please respond asap as i would like to get a working build out by tomorrow.
Kerpato, CEO of Tactical Train Wreck Studios
First of all you should have platform behavior for enemies and "default control" set to No.
Making enemy walk towards player:
Compare player.X < Enemy.X : Enemy Simulate control Left
Else: Enemy Simulate control Right
For attacking on contact use "Is overlapping" or "On contact" condition.
For shooting you propably should first compare distance(player.X, player.Y, Enemy.X, Enemy.Y) to some suitable value to see that enemy is not too far to shoot. If you want to shoot only in horizontal level compare abs(Player.Y - Enemy.Y) to some small value.
For jumping maybe check that distance(player.X, player.Y, Enemy.X, Enemy.Y) is short enough and player.Y < Enemy.Y.
Then you can use Simulate control Up action.
But if you want anything decent out tomorrow and don't have an enemy AI worked out yet, you are propably some weeks behind the schedule anyway.
Develop games in your browser. Powerful, performant & highly capable.
How do you check the distance?
Use system conditition "Compare two values". One of the values is distance between player and enemy e.g. distance(player.X, player.Y, Enemy.X, Enemy.Y), and other can be any value you choose.