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

Post Reply  Post Oekaki 
 

Posted By Message

Slowbro



Registered
  12/3/2007
Points
  71

VIP MemberPS3 OwnerI like Aliens!I'm a Storm TrooperIt's-a me, Mario!I am an April Fool
21st April, 2008 at 5:47:34 PM -

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
  1/31/2003
Points
  4897

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

standard movement? some more words


 
Craps, I'm an old man!

The Cecilizer

You Done Got Cecilized

Registered
  3/19/2005
Points
  1602

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!Computer
21st April, 2008 at 5:59:09 PM -

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

 
Image

>> http://www.cecilectomy.com <<

AndyUK

Mascot Maniac

Registered
  8/1/2002
Points
  14165

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

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
  12/8/2003
Points
  11952

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

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

The Cecilizer

You Done Got Cecilized

Registered
  3/19/2005
Points
  1602

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!Computer
22nd April, 2008 at 11:11:50 AM -

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

 
Image

>> http://www.cecilectomy.com <<

DaVince

This fool just HAD to have a custom rating

Registered
  9/4/2004
Points
  8001

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


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.

 
http://davince.tengudev.com/
Still a member of Ectoprods! If it still exists, that is.

Don't take me for a FOOL!

"you purple nurple " - Del Duio

The Cecilizer

You Done Got Cecilized

Registered
  3/19/2005
Points
  1602

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!Computer
22nd April, 2008 at 12:04:23 PM -

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.

 
Image

>> http://www.cecilectomy.com <<

DaVince

This fool just HAD to have a custom rating

Registered
  9/4/2004
Points
  8001

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
22nd April, 2008 at 12:42:13 PM -

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.

 
http://davince.tengudev.com/
Still a member of Ectoprods! If it still exists, that is.

Don't take me for a FOOL!

"you purple nurple " - Del Duio

The Cecilizer

You Done Got Cecilized

Registered
  3/19/2005
Points
  1602

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!Computer
22nd April, 2008 at 1:03:36 PM -

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.

 
Image

>> http://www.cecilectomy.com <<

Joe.H

Evil Faker

Registered
  8/19/2002
Points
  3311
22nd April, 2008 at 1:17:39 PM -

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

Slowbro



Registered
  12/3/2007
Points
  71

VIP MemberPS3 OwnerI like Aliens!I'm a Storm TrooperIt's-a me, Mario!I am an April Fool
22nd April, 2008 at 5:48:10 PM -


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.

Slowbro



Registered
  12/3/2007
Points
  71

VIP MemberPS3 OwnerI like Aliens!I'm a Storm TrooperIt's-a me, Mario!I am an April Fool
22nd April, 2008 at 5:56:40 PM -

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
  9/4/2004
Points
  8001

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
23rd April, 2008 at 4:06:57 AM -


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

 
http://davince.tengudev.com/
Still a member of Ectoprods! If it still exists, that is.

Don't take me for a FOOL!

"you purple nurple " - Del Duio

The Cecilizer

You Done Got Cecilized

Registered
  3/19/2005
Points
  1602

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!Computer
23rd April, 2008 at 5:08:53 AM -

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.

 
Image

>> http://www.cecilectomy.com <<

The Cecilizer

You Done Got Cecilized

Registered
  3/19/2005
Points
  1602

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!Computer
23rd April, 2008 at 5:11:45 AM -

Image

 
Image

>> http://www.cecilectomy.com <<

Joe.H

Evil Faker

Registered
  8/19/2002
Points
  3311
23rd April, 2008 at 10:27:34 AM -

Mine's better.

*folds arms and sulks*

 
My signature is never too big!!!

The Cecilizer

You Done Got Cecilized

Registered
  3/19/2005
Points
  1602

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!Computer
23rd April, 2008 at 10:44:45 AM -

yours is good to use in a custom movement.

*pats back*

 
Image

>> http://www.cecilectomy.com <<

AndyUK

Mascot Maniac

Registered
  8/1/2002
Points
  14165

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


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
  9/4/2004
Points
  8001

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

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.

 
http://davince.tengudev.com/
Still a member of Ectoprods! If it still exists, that is.

Don't take me for a FOOL!

"you purple nurple " - Del Duio

Knudde (Shab)

Administrator
Crazy?

Registered
  1/31/2003
Points
  4897

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

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
  12/28/2006
Points
  4110

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


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.

 
-

The Cecilizer

You Done Got Cecilized

Registered
  3/19/2005
Points
  1602

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!Computer
23rd April, 2008 at 12:54:09 PM -

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.

 
Image

>> http://www.cecilectomy.com <<

Insomniac



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

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

The Cecilizer

You Done Got Cecilized

Registered
  3/19/2005
Points
  1602

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!Computer
23rd April, 2008 at 4:57:15 PM -


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.

 
Image

>> http://www.cecilectomy.com <<

Ricky

loves Left For Dead 2

Registered
  12/28/2006
Points
  4110

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

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

 
-

The Cecilizer

You Done Got Cecilized

Registered
  3/19/2005
Points
  1602

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!Computer
23rd April, 2008 at 5:09:20 PM -

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?

 
Image

>> http://www.cecilectomy.com <<

Ricky

loves Left For Dead 2

Registered
  12/28/2006
Points
  4110

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

I don't think so

Image Edited by the Author.

 
-

Fifth

Quadruped

Registered
  5/7/2003
Points
  5494

VIP MemberGOTW JULY 2010 WINNER!Kliktober Special Award TagGOTW HALLOWEEN 2011 WINNER
24th April, 2008 at 12:06:55 AM -

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

However, commenting out code can be quite useful.

 
Go Moon!
   

Post Reply



 



Advertisement

Worth A Click