no gravity movement and angles

  • Hi,

    A quick question about angles...

    How come CustomMovement.MovingAngle has negative and positive numbers and Object.Angle is all positive numbers?

    I can't compare the two without some sort of conversion.

    The only time it would work is if the player is going straight down.. both variables are 90.. but going up one is 270 and the other is -90.

    When my player reaches a certain speed I want to stop the acceleration, unless they change direction. So I want to add:

    IF CustomMovement.MovingAngle != Player.Angle

    I'm trying to emulate no gravity type physics. So you can only go a certain max speed in one direction, however in the opposite direction, increasing acceleration would slow your speed.

    I feel like there's an easier way to do this that I am overlooking...

    thanks..

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I figured it out incase anyone else wants to know.

    I found the anglediff function which successfully compares 2 angles even if one angle is 0-360 and the other one is 0-180 (and negative numbers)

    So I compare:

    anglediff(floor(Player.CustomMovement.MovingAngle),floor(Player.Angle))

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)