
Originally Posted by
RickyRombo
* Enemy overlaps player
OR
* Enemy overlaps player 2
-- Attack
Yep, that's the best way I can think of.
I don't use extensions alot, so I always use a bouncing ball enemy. Use something like;
Code:
-->Every 50 hundreths of a second
== Enemy -> Look in direction of player.
If you want the enemy to only chase the player when he is near the enemy, use a "Line of Sight".
Create a wide, colored in circle that is semi-transperant, with its origin at the middle.
Code:
--> Always
== LOS set pos to 0,0 of player
Then;
Code:
--> Enemy overlaps LOS
++ Every 10 hundreths of second
== Enemy movement start
== Enemy direction look in direction of 0,0 from player
If not overlapping
Code:
--> NEGATE Enemy overlaps LOS
== Enemy movement Stop.
*or*
Code:
--> NEGATE Enemy overlaps LOS
++ Every 90 hundreths of a second
== Enemy movement start
== Enemy set direction to Random(32)
The top means the enemy stops dead, the bottom makes the enemy wander around.
You will also need;
Code:
--> Enemy collides with backdrop
== Enemy bounce.
Its a lot of code, but it should work for a bouncing ball movement. I use it a lot in my work for enemies that chase the player, but then stop and lose interest when the player runs away.