You can make it move away by testing it's X and Y coordinates.
(so if we say object 2 is the one that is running away)
If object 2's X is greater than object 1's X then move object 2 +1 pixel along it's X axis. (meaning it will run to the right if it's on the right hand side of object 1)
I'm sure you can work out the other directions from that
try that out davince. see if it works. it wont. lol.
it has to first look in the direction of what its running away from. otherwise its just gonna go back and forth.
at least im pretty sure. i will try it out but logically it shouldnt work.
n/a
DaVince This fool just HAD to have a custom rating
Registered 04/09/2004
Points 7998
22nd April, 2008 at 12:42:13 -
It shouldn't go back and forth... It should go the opposite way of the other object, because it isn't instructed to do anything else. If it doesn't behave like that it's a bug in MMF.
it still wont work correctly. it just means it will go the opposite of whatever direction you are going. if your facing up it will go down. but it wont run "away" from you.
if your facing up and the other guy is to your left you want him to run left away from you. not run/face down.
Distance = Square root ((X character - X object)^2 + (Y character - Y Object)^2)
--
Distance < 50 (can be changed depending on how close you want before running away
+ Flag 0 (Object B) = off
= Object B > Set direction to Direction("Object B") - 16
+ Object B > Set Flag 0 on
+ Object B > Start running away (+ speed up movement optional here)
Distance >= 200 (can be changed depending on how far away you want to be before the object stops running)
+ Flag 0 (Object B) = On
= Object B > Stop running away (+ return movement to normal speed)
+ Object B > Set flag 0 off
---
That's one way of doing it. for 8 directional movement
For 2 directional movement (i.e left right)
Try doing:
--
Distance < 50 (can be changed depending on how close you want before running away
+ Flag 0 (Object B) = off
+ X(Object A) > X(Object B)
= Object B > Set Direction to Left
+ Object B > Set Flag 0 on
+ Object B > Start running away (+ speed up movement optional here)
Then the same but with X Obj A < X obj B, and direction to right
Where Distance is now square root((X character - X Object)^2)
--
DaVince This fool just HAD to have a custom rating
Registered 04/09/2004
Points 7998
23rd April, 2008 at 04:06:57 -
Originally Posted by cecil try that out davince. see if it works. it wont. lol.
it has to first look in the direction of what its running away from. otherwise its just gonna go back and forth.
at least im pretty sure. i will try it out but logically it shouldnt work.
Actually, your code should do exactly the same as mine, as the result of both is "set direction to direction opposite of object 2's". If you want something more complicated...
davince i just thought of something else. if you run towards the other object it will make it run TOWARDS the character. it just doesnt work. you gotta have the two events.
i put yours into mmf and it does exactly that. its not running aaway its just running the opposite direction of the character (which in some instances is actually towards the player)
its logically flawed and its apperent when you do it in mmf.
Yes, but it might be too much to handle for Fish20.
.
DaVince This fool just HAD to have a custom rating
Registered 04/09/2004
Points 7998
23rd April, 2008 at 12:10:43 -
Originally Posted by cecil
I don't get it. Both should look like mine, since both result in the same value - direction of object 2 -16. So both should have been flawed in that case...
Seriously, think about it. How does (set dir to dir of object 2, then subtract 16 from it) differ from (set dir to dir of object 2 - 16)? It should, logically, result in the same value.
Originally Posted by DaVince [Ectoprods] Originally Posted by cecil
I don't get it. Both should look like mine, since both result in the same value - direction of object 2 -16. So both should have been flawed in that case...
Seriously, think about it. How does (set dir to dir of object 2, then subtract 16 from it) differ from (set dir to dir of object 2 - 16)? It should, logically, result in the same value.
They are not the same value. Cecil said: Look in Direction of the other object. You said: look the same dierction he's looking, which is completely different then looking at it. It's the position of object 2 that determins your direction, Not object 2's dirrection.
P.S.
sorry for spelling mistakes (I'm at school and they don't have fire fox )
Originally Posted by Insomniac If you have top-down view(Not platformer, unless the guy who runs away can fly) simply set the runner's movement to Bouncing Ball Then enter
Never-Look at 0,0 from whatever he's running from.
what the hell? O_o
that would (and does) absolutely nothing, insomniac.
to me the only use for "never" is for removing an event without actually removing it. like commenting it out of the code.
is there really any other reason for having it?