This is a very simple AI for enemies that run left and right and jump over obstacles of different heights.

Add a boolean variable called 'isHigh' to the obstacle objects. True = 2 blocks high, False = 1 block high.
Add a "JumpRay" point to the enemy objects.
Next, create a new extension and give it a name. In this case, I’ve called it 'Enemy_AI'.
Next, add any additional behaviors that this behavior requires. In this case, I’m using the platformer behavior for enemy movement.
Next, add a function to the behavior and use doStepPreEvents.
Next, add an Action function and name it 'JumpOverObstacle' or choose a name that fits your needs.
Now, find and add the created behavior to the enemy objects. In this case, add it to the GreenEnemy and RedEnemy.
Next, call the function in the event editor.
And there you have it! Now you have a very simple enemy AI!
Comments
Post a Comment