Rotating a Layer

Get help using Construct 2

Post » Tue Nov 13, 2012 10:34 pm

!WildShroom2012-11-21 10:06:44
B
5
Posts: 32
Reputation: 789

Post » Wed Nov 14, 2012 12:34 am

Could you post your CAPX or at least a CAPX with the issue you have if you don't want to post your full game.

I don't have the full version of C2 so I can't confirm this would work 100% but you could put all the level items into a family then rotate them when you need to and not the actual layer. If the player sprite isn't in the family then in theory it wouldn't rotate with everything else.vandinz2012-11-14 00:41:00
B
19
S
5
G
4
Posts: 208
Reputation: 3,960

Post » Wed Nov 14, 2012 2:56 am

!WildShroom2012-11-21 10:06:54
B
5
Posts: 32
Reputation: 789

Post » Wed Nov 14, 2012 2:57 am

!WildShroom2012-11-21 10:06:31
B
5
Posts: 32
Reputation: 789

Post » Wed Nov 14, 2012 5:16 am

Ok, I think I see what's going on. It took me a few tries to understand your problem. In system, there isn't actually a "rotate layer" event, only "set layer (or layout) angle". The angle you tell it is a fixed angle. It's not going to rotate.

So try this...

On touch object, set (system) layer to "LayerAngle(layer)+90"
where "(layer)" is the name or number of your layer. So for instance if your layer is on layer 1 (that's the actual number identified by C2 on the right hand menu) you would have "LayerAngle(1)+90".



Now everytime you click on the object it will rotate an extra 90 degrees.

Is that what you meant?
B
14
S
5
G
4
Posts: 121
Reputation: 3,938

Post » Wed Nov 14, 2012 5:35 am

!WildShroom2012-11-21 10:06:16
B
5
Posts: 32
Reputation: 789

Post » Wed Nov 14, 2012 5:45 am

!WildShroom2012-11-21 10:06:01
B
5
Posts: 32
Reputation: 789

Post » Wed Nov 14, 2012 5:51 am

What I'm saying is that you HAVE to use the whole string. What it is doing is telling the system to take the current angle and add 90 degrees. So if the current angle is 0, it will add 90, making it 90. If the current angle is 90, it will add 90, making it 180. You can also use the minus sign to subtract 90.

In your case it would look something like this (where what is in quotes is what you actually type, not the quotes)...

On touched TouchRight, system --> set layer 0 to "LayerAngle(0)+90" degrees

On touched TouchLeft, system --> set layer 0 to "LayerAngle(0)-90" degrees
B
14
S
5
G
4
Posts: 121
Reputation: 3,938

Post » Wed Nov 14, 2012 5:57 am

!WildShroom2012-11-21 10:05:46
B
5
Posts: 32
Reputation: 789

Post » Wed Nov 14, 2012 5:59 am

!WildShroom2012-11-21 10:05:33
B
5
Posts: 32
Reputation: 789

Next

Return to How do I....?

Who is online

Users browsing this forum: Zebbi and 23 guests