no gravity movement and angles

Get help using Construct 2

Post » Mon Sep 23, 2013 3:31 am

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..
B
98
S
32
G
16
Posts: 1,204
Reputation: 16,715

Post » Tue Sep 24, 2013 1:59 am

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))
B
98
S
32
G
16
Posts: 1,204
Reputation: 16,715


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, valefor and 8 guests