Absolute Speed Equation for self.velocity?

8x8n88x8n8 Member, PRO Posts: 81
edited November -1 in Working with GS (Mac)
So I'm making the platformer where the player character can often be moving really fast in any direction. I'm designing the jump mechanic and I've almost got it to a tee except for one thing.

In a nutshell I want it to look like this:

Rule
When Mouse Click (I'm using click atm for testing, will be screen touch)
Move to
mouseposition.x, mouseposition.y
at speed self.velocity + 300

I just can't figure out how to get a unified variable for the speed of an actor. Because GS only gives us x and y independently and also x and y speeds are always switching from positive to negative, I need some equation to get the absolute speed of an actor from. I tried text displaying self.angularvelocity but that always seems to be 0.

I've also tried googling for this equation, but I'm not sure which terminology to use, my results are always crap like answers to dumb textbook questions about trains and airplanes vs windspeed lol.

Comments

  • 8x8n88x8n8 Member, PRO Posts: 81
    So I figured it out: it's the Pythagorean Theorem :P

    sqrt(abs(x^2)+abs(x^2)) = speed

    In case anyone was interested...
Sign In or Register to comment.