What's the difference between "Forwards" and "Self.Angle"

0 favourites
  • 5 posts
  • I'm reading through the Asteroids Clone tutorial (in under 100 events).

    I notice that to accelerate the player's ship we do this:

    Accelerate CustomMovement 100 at angle Self.Angle

    I also notice that to decelerate the player's ship we do this:

    Accelerate CustomMovement Forwards -100

    What's the difference between "Forwards" and "Self.Angle"?

    Thank you,

    -copilot

  • There shouldn't be a difference. Why the person who wrote the tutorial used both, I wouldn't know.

  • I tried replacing "Self.Angle" with "Forwards" in this statement

    Accelerate CustomMovement 100 at angle Self.Angle

    When I do that, the object just moves right, regardless of whether it is rotated. That's what's puzzling me.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here's a link to an example capx

    (sorry I need to split the URL below because it does not allow me to insert links into forum posts yet - I don't have enough reputation).

    https://

    dropbox.com/s/zrf370vwz6mqdm6/DifferenceBetweenForwardsAndSelfAngle.capx?dl=0

    If you press "w" the player accelerates to the right.

    If you press "left arrow" the player rotates counter-clockwise.

    If you press "up arrow" the player accelerates toward self.angle.

    If you try pressing "w" then "left arrow" and then "up arrow" you'll see the player move in the direction the player is facing.

    If you try pressing "w" then "left arrow" and then "w" you'll see the player continue to move right regardless of where the player is facing.

    So, there's clearly a difference between the two. I don't know what "Forwards" keys off of. It can't be the angle. Perhaps it's just the direction of the sprite when it was inserted into a layout?

  • In simple words,

    There are two angles (like in bullet behavior) one is responsible for displaying a rotation of the sprite and second one for moving it.

    At start of the game angle of motion for this sprite is 0 - that's why if you set "Accelerate CustomMovement Forwards 100" it will only go right - check the vectors in debugger.

    But if you need to move in a direction then you need to specify the speed and direction (angle of motion) - Accelerate CustomMovement 100 at angle Self.Angle.

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