# Rotating a Layer

0 favourites
• 17 posts
• !

• 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.

• !

• !

• 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".

<img src="http://wayofthesax.com/img/rotate%20layer.png" border="0" />

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

Is that what you meant?

• !

• !

• 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

• !

• !

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• !

• I don't know, man. I tried to recreate your results, but I don't know how to fix this one. I don't have any experience with the platform behavior at this point.

• What I got was when I rotated it, the player falls through the solid wall I created. I think there was a fix somewhere on the forum, but I don't remember what it was.

• It would be easier to help if you would post a capx that reproduces your issue since with your explanations it's hard to figure how you set things so far and what your issue actually is.