The Daily Click ::. Forums ::. Klik Coding Help ::. Run away
 

Post Reply  Post Oekaki 
 

Posted By Message

Fish20



Registered
  03/12/2007
Points
  257

VIP MemberPS3 OwnerI like Aliens!I'm a Storm TrooperIt's-a me, Mario!I am an April FoolPicture Me This Round 48 Winner!
21st April, 2008 at 17:47:34 -

how could you make an object run in the oppisite direction of another one?

 
All your base are in another castle, take this.

Knudde (Shab)

Administrator
Crazy?

Registered
  31/01/2003
Points
  5125

Has Donated, Thank You!Clickzine StaffKlikCast StarVIP MemberGhostbuster!Dos Rules!I donated an open source project
21st April, 2008 at 17:50:21 -

standard movement? some more words


 
Craps, I'm an old man!

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
21st April, 2008 at 17:59:09 -

ball movement with this event works

object 1 is the one running away
object 2 is the one being run from

+always
-look in direction of object 2
-set direction to Dir( "object 1" ) - 16

 
n/a

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14560

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
22nd April, 2008 at 10:45:14 -

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

 
.

Dr. James MD

Addict

Registered
  08/12/2003
Points
  11941

First GOTW AwardSecond GOTW AwardThird GOTW AwardPicture Me This -Round 26- Winner!
22nd April, 2008 at 10:50:00 -

The 2 answers above are good answers above.

 
Image
http://uk.youtube.com/watch?v=j--8iXVv2_U
On the sixth day God created Manchester
"You gotta get that sand out your vaj!" x13
www.bossbaddie.com

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
22nd April, 2008 at 11:11:50 -

it also depends what kind of movement youre looking for. top down? platform?

 
n/a

DaVince

This fool just HAD to have a custom rating

Registered
  04/09/2004
Points
  7998

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
22nd April, 2008 at 11:43:15 -


Originally Posted by cecil
+always
-look in direction of object 2
-set direction to Dir( "object 1" ) - 16


Err...

+always
-set direction to Dir("object 2") - 16

That's one action less.

 
Old member (~2004-2007).

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
22nd April, 2008 at 12:04:23 -

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

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
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.

 
Old member (~2004-2007).

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
22nd April, 2008 at 13:03:36 -

i see. you changed it to object 2.

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.

 
n/a

Joe.H

Evil Faker

Registered
  19/08/2002
Points
  3305
22nd April, 2008 at 13:17:39 -

Object A = character
Object B = runaway object

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)
--



P.s. Yes, I do accept paypal payments.

Image Edited by the Author.

 
My signature is never too big!!!

Fish20



Registered
  03/12/2007
Points
  257

VIP MemberPS3 OwnerI like Aliens!I'm a Storm TrooperIt's-a me, Mario!I am an April FoolPicture Me This Round 48 Winner!
22nd April, 2008 at 17:48:10 -


Originally Posted by DaVince [Ectoprods]

Originally Posted by cecil
+always
-look in direction of object 2
-set direction to Dir( "object 1" ) - 16


Err...

+always
-set direction to Dir("object 2") - 16

That's one action less.



Davince's one didnt go anywhere because it kept changing back and forth forever.

 
All your base are in another castle, take this.

Fish20



Registered
  03/12/2007
Points
  257

VIP MemberPS3 OwnerI like Aliens!I'm a Storm TrooperIt's-a me, Mario!I am an April FoolPicture Me This Round 48 Winner!
22nd April, 2008 at 17:56:40 -

I tried cecil's and it worked. Thanks!

 
All your base are in another castle, take this.

DaVince

This fool just HAD to have a custom rating

Registered
  04/09/2004
Points
  7998

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
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...

 
Old member (~2004-2007).

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
23rd April, 2008 at 05:08:53 -

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.

 
n/a

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
23rd April, 2008 at 05:11:45 -

Image

 
n/a

Joe.H

Evil Faker

Registered
  19/08/2002
Points
  3305
23rd April, 2008 at 10:27:34 -

Mine's better.

*folds arms and sulks*

 
My signature is never too big!!!

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
23rd April, 2008 at 10:44:45 -

yours is good to use in a custom movement.

*pats back*

 
n/a

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14560

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
23rd April, 2008 at 11:36:33 -


Originally Posted by Not Clubsoft
Mine's better.

*folds arms and sulks*



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

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
23rd April, 2008 at 12:10:43 -

Originally Posted by cecil
Image
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.

 
Old member (~2004-2007).

Knudde (Shab)

Administrator
Crazy?

Registered
  31/01/2003
Points
  5125

Has Donated, Thank You!Clickzine StaffKlikCast StarVIP MemberGhostbuster!Dos Rules!I donated an open source project
23rd April, 2008 at 12:21:15 -

Lol you guys, it's because there's that "Always" event. That's why dude keeps spazzing.

 
Craps, I'm an old man!

Ricky

loves Left For Dead 2

Registered
  28/12/2006
Points
  4175

Has Donated, Thank You!Game of the Week WinnerVIP MemberWii OwnerHero of TimeGOTM Winner! - November 2009I am an April Fool
23rd April, 2008 at 12:51:38 -


Originally Posted by DaVince [Ectoprods]
Originally Posted by cecil
Image
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 )

Image Edited by the Author.

 
-

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
23rd April, 2008 at 12:54:09 -

because its 'look in direction' not 'set to direction'

im serious. open up mmf and do both.

mine says "hey, look at that over there, then turn and run"

yours says "hey, face the same direction as that thing over there and run"

they are completely different.

 
n/a

Insomniac



Registered
  19/04/2008
Points
  5
23rd April, 2008 at 16:49:16 -

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.

 
When sleep is a luxury...

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
23rd April, 2008 at 16:57:15 -


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.

 
n/a

Ricky

loves Left For Dead 2

Registered
  28/12/2006
Points
  4175

Has Donated, Thank You!Game of the Week WinnerVIP MemberWii OwnerHero of TimeGOTM Winner! - November 2009I am an April Fool
23rd April, 2008 at 17:02:46 -

never is the same as the event not existing at all.

 
-

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
23rd April, 2008 at 17:09:20 -

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?

 
n/a

Ricky

loves Left For Dead 2

Registered
  28/12/2006
Points
  4175

Has Donated, Thank You!Game of the Week WinnerVIP MemberWii OwnerHero of TimeGOTM Winner! - November 2009I am an April Fool
23rd April, 2008 at 17:22:43 -

I don't think so

Image Edited by the Author.

 
-

Fifth

Quadruped

Registered
  07/05/2003
Points
  5715

VIP MemberGOTW JULY 2010 WINNER!Kliktober Special Award TagGOTW HALLOWEEN 2011 WINNERPicture Me This Round 51 Winner!
24th April, 2008 at 00:06:55 -

Heheh... "Never: the condition that cannot be met."

However, commenting out code can be quite useful.

 
Go Moon!
   

Post Reply



 



Advertisement

Worth A Click