Page 1 of 1

Opposite to MoveTo

PostPosted: Wed Dec 06, 2006 6:32 pm
by Troodon
Hi,
Is there any way to make opposite of MoveTo code?
I mean that instead of going towards an actor, the main actor goes in opposite direction. I'm working on a game where an actor should escape monsters itself. :wink:

PostPosted: Thu Dec 07, 2006 12:03 am
by sonicfire
great idea! but this should be possible using code ... but if easily or not - i dont know :? :D

PostPosted: Thu Dec 07, 2006 12:09 am
by Game A Gogo
use something like this:
Code: Select all
direction("ennemy.x"."ennemy.y","x","y");
directional_velocity=2;


something like that.
[/code]

PostPosted: Thu Dec 07, 2006 1:01 pm
by Troodon
:wink: Thanks, but with that code it says only:
illegal structure operation

Is there another code I could try?

PostPosted: Thu Dec 07, 2006 1:13 pm
by Novice
Use this
Code: Select all
angle=direction(actor1.x, actor1.y, actor2.x, actor2.y); +180;
directional_velocity=4;

I tired it out and it works great.

BTW. remember to change the actor names and velocity to suit your game.

PostPosted: Thu Dec 07, 2006 1:30 pm
by Troodon
WOW!! :shock: Thanks! It works like a seal!
Now I only have to make that if the distance is smaller than something it escapes, but I think I can make it myself. :D

PostPosted: Fri Dec 08, 2006 12:25 am
by Game A Gogo
AHHH, i knew i forgot something!