HERE COMES THE BIGGEST TEXT EVAR
I am making a game where you can craft your ship. However the Thrusters aren't working as intended, because they should respect equilibrium basics. In the current game, if you put only one thruster at the side of the spaceship, it goes forward. But instead it should rotate, so the player would have to place two thrusters one at each side of the spaceship to prevent rotation...
I have tried many ways of doing this work but I can't figure it out.
Currently, it tests if the Thruster's Angle is in a 180º range in relation to the ship's angle with the Thruster...
[quote:2265jegw]ShipComponent.Angle - 180 <= angle(Shipcore.x,Shipcore.y,ShipComponent.x,ShipComponent.y) <= ShipCoponent.Angle + 180
If it is, spin counterclowise! If not, spin clockwise. So if we placed the thruster at the right of the ship (angle 0) facing upwards (what on the sprite is angle 0) it is on the range and SHOULD spin counterclockwise. And placing the thruster at the left of the ship (angle 180) facing upwards (the sprite's default animation is upwards when angle is 0) it is out of the range and is should spin clockwise.
And it worked... if you place the Thruster on the left side of the ship, it spins clockwise. However if I place the Thruster on the right side of the ship, instead of turning counter-clockwise, it just doesn't spin... it get stuck between 0 and 359 degrees!
Maybe it's something with negative numbers. Calculation number 1 of angle gives me negative values such as -90. But the angles of the Thrusters would give me 270 instead of -90... But I am lost at this point...
CAPX: https://www.dropbox.com/s/bvu1nno4h34xg ... .capx?dl=0
Thank you, if you can help me.
Thank you for reading anyway, it was a very big text.