Condition for rotation

For questions about using Classic.

Post » Wed Aug 29, 2012 3:10 pm

basicly i am making a spaceship. and i though that to make it feel more realistic the ship could have 3 x thrusters. the back one, left and right. if the ship fly forward the back one would work. if its rotating left - the right one would work, if right - the left one. and so on.
the problem is neither i or my buddy can determinate a condition for that. as far as i checked theres no IF spriteX is rotating (counter)clockwise or IF angle is increasing/decreasing.

the problem is that the ship is not conroled directly by the player. it has RTS beh that always forces him to fly to the Pointer sprite.

any idea?

the only option i see so far is to create my own custome made RTS behaviour but if its possibly i would prefer to avoide that (i am already far behind my deadlines and any additional work is a salty bite to swallow)irbis2012-08-29 15:14:03
ImageImageImageImage
B
26
S
7
G
7
Posts: 572
Reputation: 6,097

Post » Thu Aug 30, 2012 11:04 am

You can store the previous angle (either Sprite.Angle or Sprite[RTS].MovAngle) every 10 milliseconds (or similar) to a private variable, and then check the difference between them to check if a turn has been made.Jayjay2012-08-30 11:04:30
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Thu Aug 30, 2012 5:18 pm

we tried that. and it mostly works, with a few but very crusial exceptions..

there is 360 degres total. now the spaceship is facing 10 degree. and he need to be turned LEFT to 350 degree. now, logicaly thats only 20 degress diffrence but the engine will count not the logical diffrence but the technical diffrence. for math jumping from 10 to 360 will be read as increased. even when you just gone down and came on the other end.
i tested this =\
ImageImageImageImage
B
26
S
7
G
7
Posts: 572
Reputation: 6,097

Post » Thu Aug 30, 2012 11:33 pm

Just use the system object's condition "Angle is clockwise/anticlockwise of" ConstructWIKI (scroll down)

That's what it's for
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests