Can someone explain the MoveTo behaviour's movingAngle?

0 favourites
  • 7 posts
  • I'm having trouble understanding the movingAngle expression values related to the MoveTo behavior. I even made a simple capx to test it but the values remain a mystery to me: sometimes when I make the object move right I get a negative value, but sometimes it's positive.

    Here's the capx, simply click with mouse (or touch) in order to move the arrow. The movingAngle will be displayed in the text box:

    drive.google.com/file/d/12djpC7S2MefwIq3ZXg-y_errvb5jH09I/view

    Any help would be appreciated. I need this to make the object mirrored when moving left and not mirrored when moving right.

    Tagged:

  • Object.angle is the object's visual angle. Set it to 180, and it's upside down on the screen.

    Object.moveTo.movingAngle is the angle of direction in which the move to behavior is moving, this one is calculated automatically while it's moving. I.e. you tell an Object to move from x0,y0 to x0,y10 then the object would physically move straight down, move To.movingAngle would be 180.

    Imagine a clock, which moves to the right, having its hour dial stuck at 12 o clock. If I want the clock hour dial to always face up while the clock is moving, I would ignore the moving angle for my objects actual angle. Object angle would be 0 and my move To.movingAngle would be 90.

    Now imagine a bullet.

    Shooting it straight down, that would be 180 moveTo.movingAngle. Now, if my bullet would ignore the moving angle, my bullet would likely face right and move down.

    If I want it to look pretty, I would tell my bullet object.angle to take the angle of the moving direction to make it look esthetically correct.

    Bullet.angle = Bullet.moveTo.movingAngle

    There is an option in the moveTo behavior to set the angle for you.(tick box)

  • Hi!

    Thanks for your explanation. I guess I'm a bit confused why the moving angles are different from the basic angle system of Construct, where north is 270 and south is 90. Why does movingAngle go into negative values?

  • Hey there Ecation :)

    That is because, in your example file. You are reading the angle that the Sprite made to look like an arrow is moving.

    If any object in Construct 3 is moving towards the Right on the X Axis, or Down on the Y Axis it is moving in a positive direction. If an object is moving Left on the X Axis, or Up on the Y Axis, it moves in the opposite direction, which then become negative.

    So to make a platform object jump, you are changing the direction of movement into a negative number/value. Or say a trampoline in my current project. When the player lands on top of it in any way, it will set Platform Vector Y to -600 or -2000 depending on which trampoline is jumped onto(and how I've setup that trampoline's power variable). Which shoots the player upwards, and acts as a high jump.

    If you start falling from that jump, then it's now moving in a positive direction on the Y Axis, from it's current position moving downward.

    I hope that makes a little sense. The easiest way I learned angles and directions of movement in Construct 3. Is moving my mouse around the Layout Editor, and then watching the "Mouse: (x, y)" in the bottom right of the Layout Editor window. Moving it around, you can see the X and Y values increasing/decreasing, depending on the direction you move your mouse cursor.

    EDIT: To further clarify. It's different from the facing angle. The facing angle works like a clock as mentioned earlier. Where facing right is 0, down is 90, left is 180, up is 270. Then right before completely becoming right faced again it goes from 270-359, then hits 0 when the object faces exactly to the right again.

    So the Object facing angles, and the movement X & Y values are different in the way they work. After messing around and creating different games in Construct 3 it becomes much clearer over time. It took me a while of playing around with my Mouse Cursor location in the layout view. As well as manipulating object angles in the layout editor properties on the left hand side directly to figure it out.

    FURTHER EDITS: Clarifying between "angles" and "directions" in some areas, to hopefully have this make more sense.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sorry for the double post. But, to see the difference. You can open the example you provided originally. Select the Arrow Sprite in the Layout Editor. Then manually change the "Angle" field in the Properties on the left hand side to different values, from 0-359 to see what we are talking about as far as visual/facing angle

    EDIT: It also appears the example is only reading off the movement on the Y Axis. So up is negative, down is positive.

  • Thank you very much for this explanation!

  • Thank you very much for this explanation!

    Of Course. You're Welcome :)

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