move to actor distance and clone collision help
Posted:
Sun Jun 10, 2007 5:39 pm
by J Slayer67
is there any way to have an actor collide with it's clone and only make the enemies move towards the charecter at a certain distance (like if the actor was
n close enemy move to player) but also have it so that once the player is far enough away, the enemy would stop following the player?
Sorry it's
A LOT for one post but some help would be greatly appreciated
Posted:
Sun Jun 10, 2007 6:28 pm
by pixelpoop
Use an "if" statement with a "distance" check on the enemy Draw Actor script.
if ( distance(x, y, player.x, player.y)<40 &&
distance(x, y, player.x, player.y)>5) {moveto(player.x, player.y);}
I haven't tested this but it should work.
EDIT: I changed the > signs.
Posted:
Mon Jun 11, 2007 2:05 am
by J Slayer67
thx
ill tell u if it works...do u know how to have 1 actor collide with it's clone?
Posted:
Mon Jun 11, 2007 11:43 am
by pixelpoop
Do you mean that you want the enemy clones to not overlap while they move to your player? in that case replace the moveto command in the above script with this one:
MoveTo(clonename, 0, 0, 1, "playeractor", "enemyname");
Don't change where it says clonename.
Change the 1 to any velocity you like, although it gets glitchy at higher rates.
Change the playeractor to the name of the actor to move towards.
Change the enemyname to the name of the enemy whose script this is on.
Also, I changed the code in my first post, so check it.
Posted:
Mon Jun 11, 2007 12:26 pm
by J Slayer67
thanks i'm not making a very big game but it'll be my first with lvls so i want it to be (some what) cool becuse i might post it here when it's finished.