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

Get help using Construct 2

### » Mon Oct 26, 2015 9:56 pm

I'm trying to make a game that rotates the Layout 90º if you press a key and rotates -90º if you press another key.

How can I rotate the Layout and the gravity?

When the Layout rotates you can see how it rotates, is not instantly.

B
3
Posts: 9
Reputation: 193

### » Tue Oct 27, 2015 1:50 am

Your suggesting turning everything in the layout including gravity?

This is a really interesting concept I haven't tried... Might take a crack at it this week...
Eat ALL THE BACON!
B
47
S
17
G
3
Posts: 292
Reputation: 5,079

### » Tue Oct 27, 2015 1:56 am

Is it like a Platformer/Mario style game? or what kind of game is it?
B
26
S
7
G
1
Posts: 90
Reputation: 2,145

### » Tue Oct 27, 2015 7:22 am

Yes, including gravity, at once, like the world rotating.

Its for a platformer game.
B
3
Posts: 9
Reputation: 193

### » Tue Oct 27, 2015 10:54 am

Have you looked at the rotating platformer example shipped with Construct2?
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

### » Tue Oct 27, 2015 11:26 am

LittleStain wrote:Have you looked at the rotating platformer example shipped with Construct2?

Yeah, I did it, but is not exactly what I want. The example rotates every tick towards the player. I want to rotate the Layout 90º when a key is pressed and you can see how it rotates. I mean: LayouAngle(0) += 1 until LayoutAngle(0) = LayoutAngle(0) + 90.

Incrementing the layout angle in 1 until 90, 180, 270, 360. And if its >= 360, put it on 0.

I have the idea in code, but not in Events xD
B
3
Posts: 9
Reputation: 193

### » Tue Oct 27, 2015 11:35 am

Something like this?

Global variable "LayoutNewAngle"

on key pressed
_ System add 90 to "LayoutNewAngle"

system compare two values LayoutAngle not equal to LayoutNewAngle
> System set LayoutAngle : LayoutAngle+1
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

### » Tue Oct 27, 2015 12:08 pm

I'll try this, many thanks .

I will tell later if it doesnt works
B
3
Posts: 9
Reputation: 193

### » Tue Oct 27, 2015 3:57 pm

It works, but it doesn't stop when LayoutAngle is grater than 270º. Any idea?
B
3
Posts: 9
Reputation: 193

### » Tue Oct 27, 2015 4:06 pm

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

Next