Landcape/portrait screen


#1

hello, i would like to know how it would be possible to create a game with different screen orientations. one part I want to set up a questionnaire and in another part a scene that needs to be landscape. it would be possible? and how would i do? knowing that I don’t care about the tilt or sensors of the phone, I just want the game to flip the screen


#2

I don’t think there are any currently conditionals to check the orientation of the screen, but if you change your game properties “Game resolution resize mode” to none, then you can add conditionals to look at the screen and window size for changes, and the ratio of height to width should inform you of the current orientation.


#3

There’s not a way in GDevelop at present, but it is possible with a little bit of JS. Check this thread and use that for possible solution.


#4

MrMen’s option may be a “Cleaner” solution, but Krunkster’s is probably how I would do it as I don’t want to mess with JS.

If Width is greater than Height, it’s in landscape orientation. If Height is greater than Width, it’s in portrait. You can check these with the SceneWidth/ScreenWidth/etc expressions, and combine them with the “Compare Two Number” conditions.