Discuss Scratch

Alexcamostyle
Scratcher
81 posts

Enemies that follow you in live time. (NOT in a scrolling game) NEED HELP

I want the enemies in a game I am making to follow the player in live time. (As in, the player moves, so does the enemy.) I can't have the enemy
point towards the player, that would mess my game up. Is there a way to do this?
turkey3
Scratcher
1000+ posts

Enemies that follow you in live time. (NOT in a scrolling game) NEED HELP

when gf clicked //enemy script
set rotation style [left-right v]
forever
if <([x position v] of [player v]) < (x position)>
point in direction (-90 v)
change x by (-3)
else
point in direction (90 v)
change x by (3)
end

Alexcamostyle
Scratcher
81 posts

Enemies that follow you in live time. (NOT in a scrolling game) NEED HELP

turkey3 wrote:

when gf clicked //enemy script
set rotation style [left-right v]
forever
if <([x position v] of [player v]) < (x position)>
point in direction (-90 v)
change x by (-3)
else
point in direction (90 v)
change x by (3)
end

Thanks! Can I do the same with Y?
Theprodigy
Scratcher
100+ posts

Enemies that follow you in live time. (NOT in a scrolling game) NEED HELP

In the same way:
if <([y position v] of [player  v]) < (y position)> then
change y by (-3)
else
change y by (3)
end
Just add this to the script turkey3 posted (put it in the forever loop)
Alexcamostyle
Scratcher
81 posts

Enemies that follow you in live time. (NOT in a scrolling game) NEED HELP

Thank you both! These ideas worked. (I tweaked it a bit, to fit my game)

Powered by DjangoBB