how i get distance from x and y individual between two objects?

guillefaceguilleface Member Posts: 1,014
edited February 2012 in Working with GS (Mac)
hi, i know how to use magnitude,but i need this time x and y in a separated rule. thanks

Comments

  • morphinegamingmachinemorphinegamingmachine Member, PRO Posts: 449
    you mean u need to know the distance away from each other, not the y distance, and then the x distance??

    example
    actor a is at point x=10 y= 24
    actor b is at point x=7 y=28

    they r 3 away in the x, and 4 away in the y. which means the distanced between them it 5

    pathogorean thrym for the hypotenuse
    a^2+b^2=c^2
    so diagonal distance= square root of (difference in x ^2 + difference in y^2)
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    edited February 2012
    i think you can do magnitude(self.position.x,object.x)

    subtracting the objects x from the players x might also work too
  • CloudsClouds Member Posts: 1,599
    Ignore morphinegamingmachine and JohnPapiomitis with all their clever maths . . .

    Just hold a ruler up against the screen and measure the distances, you can write the number on the back of your hand to save paper.

    Glad I could help.

    ;)
Sign In or Register to comment.