How do I rotate the Layout? (Layout+Gravity)

Get help using Construct 2

Post » Tue Oct 27, 2015 4:17 pm

LittleStain wrote:I'm not really sure what you mean..

Do you want to add an extra condition to the button event?

Something like:
System compare two values LayoutAngle < 270


I mean this: When is press a key, the Layout rotates 90º (LayoutAngle = 90) and the rotation stops. If i press it again the Layout rotates 90º more(LayoutAngle = 180). then I press again and 90º more(LayoutAngle = 270). When I press it again, it never stops rotating(Loop).

Here the code for that:
Image
newAngle is a GlobalVar initialized to 0.
B
3
Posts: 9
Reputation: 193

Post » Tue Oct 27, 2015 4:26 pm

tapasa wrote:
LittleStain wrote:I'm not really sure what you mean..

Do you want to add an extra condition to the button event?

Something like:
System compare two values LayoutAngle < 270


I mean this: When is press a key, the Layout rotates 90º (LayoutAngle = 90) and the rotation stops. If i press it again the Layout rotates 90º more(LayoutAngle = 180). then I press again and 90º more(LayoutAngle = 270). When I press it again, it never stops rotating(Loop).

Here the code for that:
Image
newAngle is a GlobalVar initialized to 0.


Well that's because C2 works with 360 degrees..
if you add 90 to 270 it will become 360, but 360 is 0 in C2, so the layoutangle goes from 359 to 0, always being lower than 360 and as such always rotating..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Oct 27, 2015 5:03 pm

Hmm..true, I will be testing some things to see if i get something-

Thank you very much for your help :D
B
3
Posts: 9
Reputation: 193

Post » Tue Oct 27, 2015 6:16 pm

Okay, I get this, I think is good, but it doesn't stops..

Image

rotarIz -> rotateLeft
rotarDer -> rotateRight
velRot -> Rotate speed
B
3
Posts: 9
Reputation: 193

Post » Tue Oct 27, 2015 7:47 pm

system set rotarzl = 0
system set rotarDer = 0
because if you add 0 to your variables, your variable still = 1 and your layout still rotates
Image Image
B
26
S
15
G
142
Posts: 881
Reputation: 74,060

Previous

Return to How do I....?

Who is online

Users browsing this forum: zenox98 and 6 guests