I want it so when the player gets close enough to an enemy, the enemy will see him and chase the player. But when the player gets far enough away, the enemy will give up the chase. Anyone?
And if TGF doesn't have the sqrt() function, use a maths extension to find the root.
This formula gives you the distance between the player and an enemy, in pixels. With multiple enemies you'd probably need to set the object focus with Pick One Of or a fastloop method.
So something like this:
sqrt((y("player")-y("enemy"))*(y("player")-y("enemy")) + (x("player")-x("enemy"))*(x("player")-x("enemy"))) < [arbitrary distance]
---Look at player and move or whatever your chase events are.
Of course, since you didn't specify what type of game you're making, I can't be specific. If it's just a platformer or whatever it can be done simply by comparing X values. If you need a better answer, supply better information.
I'm 16, and I'm not new to pythagora's. That's just not what i'm looking for. let's say the player gets 100 pixels in any direction away from the enemy, and the enemy who has a bounce ball movement sets its direction to the x,y position of the player and starts movement. Then, if the player gets beyond 100 pixels from the enemy in any direction, it gives up the chase. There's an easier way to do it, i've done it before... i just can't remember how I did it. I know I did it with alterable values though... o_O
That's just not what i'm looking for.
That's EXACTLY what the code I just gave you does. You want to find the distance between two points? Use the distance formula. There's probably an extension that can do it too, but filling in an extension function is no more difficult than copypasting the above formula.
Edit:
If you want to do it a really stupid way, put a big invisible circle over the player. I don't recommend that idea, but it's certainly 'easy'.