problems with rotating the layer

Get help using Construct 2

Post » Sun May 12, 2013 3:47 pm

I have some problems with seting my entire layer to rotate on keyboard.

1. I'w managed to create rotation per 45 in arrow keys but i have problem if key is pressed again until first 45 transitiion is not yet finished... than mine 45 become eg. 45+ 15 and everything falls apart.

im usnig this formula:
left arrow: set rotate to target angle to (immage.Angle + 45) % 360 , clockwise
right arrow: set rotate to target angle to (immage.Angle - 45) % 360 , clockwise

how can i make that mine arrow key rotates immage 45 and if pressed twice it wont apply rotation again untill reached exactly 45th degree?

2. i cant make my particles rotate (once they are created) along with rest of the screen? I'm assuming that i can only rotate point of origin and not each particle on the fly... is that correct?
Can particle rotation be even achieved at all in this manner?

Thank you!
B
26
S
11
G
2
Posts: 669
Reputation: 5,038

Post » Sun May 12, 2013 4:01 pm

1) Create a Global Variable called Rotating. Set the initial Value to 0
When the key is pressed, set the variable to one. When the layout has finnished rotating, set the variable to 0 again.
In the condition where the key is pressed, add another condition "System: Compare Variable: Rotating = 0" That way, the event wont be triggered while the thing is rotating. If you want a qued system, where it waits untill the rotation has finnished, let me know, that may take a little more explaining.

2) As far as I know, you can only rotate the point of origin. You can do this using the Angle actions in the particle that you want to rotate.

Hope this helps :)
B
10
S
2
Posts: 94
Reputation: 1,536

Post » Sun May 12, 2013 4:44 pm

Hm... its not working.

how exactly to:
When the layout has finnished rotating, set the variable to 0 again

Couse i think im making error on this point.
B
26
S
11
G
2
Posts: 669
Reputation: 5,038

Post » Sun May 12, 2013 4:47 pm

Can you post a screen shot of your events please?
B
10
S
2
Posts: 94
Reputation: 1,536

Post » Sun May 12, 2013 6:41 pm

This is how it looks now.

https://www.dropbox.com/s/qiyonvox97hfiky/rotation.jpgirina2013-05-12 18:42:51
B
26
S
11
G
2
Posts: 669
Reputation: 5,038

Post » Sun May 12, 2013 7:48 pm

Ok what you need to do is:

For the Right Arrow pressed event, add the same "rotLay = 0" condition as you did for Left Arrow Pressed.

At the END of the Left Arrow Pressed event AND the Right Arrow Pressed event, add an action "Set rotLay to 0"

At the start of the Right Arrow Pressed event, add an action "Set rotLay to 1"

That should work then.
B
10
S
2
Posts: 94
Reputation: 1,536

Post » Sun May 12, 2013 8:16 pm

its not working... :(

https://www.dropbox.com/s/tb73bqzkkk4set7/test.capx
B
26
S
11
G
2
Posts: 669
Reputation: 5,038

Post » Sun May 12, 2013 9:06 pm

Im trying now with

System: set layer angle
anglerotate(LayerAngle(0), LayerAngle(0)-45, 45)

This is better becouse it rotates particles too but i dont know how to set nice smooth transition... it just jumps by 45 :(
irina2013-05-12 21:34:37
B
26
S
11
G
2
Posts: 669
Reputation: 5,038


Return to How do I....?

Who is online

Users browsing this forum: Lof and 4 guests