Jump to content


Photo

Objects Moving Away From Other Objects


  • Please log in to reply
3 replies to this topic

#1 pat

pat

    GMC Member

  • GMC Member
  • 45 posts

Posted 07 July 2009 - 04:44 PM

Hi.  ::lmao::
Ok, so it's obvious how you make objects move towards others, but how can you make it so objects move AWAY from others?
EDIT: If it is possible, of course. (which i'm sure it is! This is Game Maker! Anything can be done, right?)
I'm hoping this isn't a duplicate topic, too... :D

Edited by pat, 07 July 2009 - 04:53 PM.

  • 0

#2 AdilFaQah

AdilFaQah

    Whiz Kid

  • GMC Member
  • 2744 posts

Posted 07 July 2009 - 04:51 PM

Well, you could try something like this:

{
  dir = point_direction(x, y, objAlpha.x, objAlpha.y) //Where objAlpha is the object you want this object to move away from.
  dir = dir + 180
  direction = dir
  speed = 5
}
Simply a matter of logic. What I did there was determine the direction of 'objAlpha' from 'this' object and add 180 to it i.e. turn the direction of 'this' object to the opposite direction.

Feel free to ask any further questions. ::lmao::
  • 0

#3 ragarnak

ragarnak

    GMC Member

  • Retired Staff
  • 19468 posts
  • Version:GM8

Posted 07 July 2009 - 04:52 PM

Ok, so it's obvious how you make objects move towards others, but how can you make it so objects move AWAY from others?

Give that command a negative speed. ::lmao::
  • 0

#4 pat

pat

    GMC Member

  • GMC Member
  • 45 posts

Posted 07 July 2009 - 04:53 PM

Oh yeah! That makes sense. *facepalm*
EDIT: However, if there is another problem. I'll be sure to post it.

Edited by pat, 07 July 2009 - 04:54 PM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users