How do I rotate only buttons when switching orientations?

Get help using Construct 2

Post » Thu Dec 04, 2014 6:52 pm

Hi folks,

I'm trying to create a game that can be played both in portrait mode and in landscape mode on Android. The thing is, when switching orientation, only certain elements should rotate. I've tried to set the project setting Orientations to Any as well as to Portrait, and then use the Browser Is Landscape/Portrait event to rotate the buttons, but it seems I can only either rotate the whole screen or nothing at all.

Am I close?
B
14
S
3
Posts: 123
Reputation: 1,571

Post » Thu Dec 04, 2014 7:53 pm

Try to lock the orientation and use the "browser" object. There is a condition for mobile orientation. (not tested).
Which runner (webviewer) are you using?
B
13
S
4
G
1
Posts: 107
Reputation: 1,337

Post » Sat Dec 06, 2014 9:40 pm

DAG wrote:Try to lock the orientation and use the "browser" object. There is a condition for mobile orientation. (not tested).
Which runner (webviewer) are you using?


I will look some more into it, haven't found a solution yet.

What do mean with webviewer? I'm testing this on an Android device after exporting from Intel XDK.
B
14
S
3
Posts: 123
Reputation: 1,571

Post » Sun Dec 07, 2014 1:19 pm

Try this. It works for me:
- Make two layouts: landscape an portrait. Both with the same event sheet.
- Add the object "Browser"
- Add to the event sheet the following conditions (Browser) and actions (System - go to layout):
- Browser > Is Portrait --- System > go to portrait
- Browser > Is Landscape ---- System > go to landscape
B
12
S
7
Posts: 5
Reputation: 1,059

Post » Sun Dec 07, 2014 1:43 pm

didakcode wrote:Try this. It works for me:
- Make two layouts: landscape an portrait. Both with the same event sheet.
- Add the object "Browser"
- Add to the event sheet the following conditions (Browser) and actions (System - go to layout):
- Browser > Is Portrait --- System > go to portrait
- Browser > Is Landscape ---- System > go to landscape


Ah, why didn't I think of that? Great idea, thanks a lot!
B
14
S
3
Posts: 123
Reputation: 1,571

Post » Sun Dec 07, 2014 3:10 pm

Actually, maybe I was a bit too quick there. How do you make sure positions of objects on screen etc are saved when switching between orientations? I'm not sure Persist will work for me.
B
14
S
3
Posts: 123
Reputation: 1,571


Return to How do I....?

Who is online

Users browsing this forum: Magistross and 8 guests