the farther away actor 2 is, the faster actor actor 1 accels - HOW?

scitunesscitunes Member, Sous Chef Posts: 4,047
edited November -1 in Working with GS (Mac)
Would I accomplish this using magnitude or something? How do you use that?

Comments

  • firemaplegamesfiremaplegames Member Posts: 3,211
    Hey,

    Magnitude, in this case, is the distance between two points - a line segment.

    It is used like this:

    DistanceBetweenActors = magnitude(abs(Actor1.X-Actor2.X),abs(Actor1.Y-Actor2.Y))

    Magnitude is a distance, and as such, always needs to be positive. That's why the abs() methods are in there as well.

    That formula will give you the distance, in pixels, between the two actors. It will increase as the distance increases.

    Joe
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    Thanks!
  • ccbx4321ccbx4321 Member Posts: 43
    Question. I see that "magnitude" is based on the distance formula for 2 points of a line, which is:

    d= Square root of ( (x2-x1)^2+(y2-y1)^2)

    When you square the results of the subtraction, wouldn't it automatically make any negative number positive anyway? Is this automatically incorporated into "magnitude" or is it necessary to specify the absolute value?

    -Caleb
Sign In or Register to comment.