How can I make a game that can be played in Portrait or Landscape modes?

HymloeHymloe Member Posts: 1,653
edited July 2012 in Working with GS (Mac)
Hi,

I would like to know if I can make a game that can be played in Portrait view, or Landscape view?

Currently, if I switch on autorotate compatibility for all directions, my game will rotate, but seeing as you have to have your HUD set up either in Landscape or Portrait in the scene, at the bottom left corner, when I rotate from Portrait to Landscape, the camera can't really handle it, and upon returning to Portrait, the camera has actually permanently shifted out of place. It doesn't return back to the original Portrait position. It's about 64 pixels higher, with the lower part of my game now offscreen. This must be a result of it having been pushed around when switching to Landscape mode.

Has anyone made a game that can be played at all four different orientations?

Do you just force your camera origin to a certain position upon each rotation change?

Do you have to reposition all your HUD elements upon each rotation change?

Cheers.

- Hymloe

Comments

  • HymloeHymloe Member Posts: 1,653
    I've put an actor in the scene that shows me the camera origin.

    When the game starts, in portrait mode, the origin is 0,0.

    When I rotate the device anti-clockwise, the camera rotates and the origin is now at 80,0. (I would have thought that the camera should move to 0,0).

    When I rotate it back to portrait again, the camera rotates back, and the origin is now at 0,80. So it doesn't go back to 0,0.

    So, by rotating the device from portrait to landscape, the camera is effectively pushed out of whack, and cannot be gotten back to where it should be. At least, not automatically.

    Any suggestions how to set up a scene to as to handle the rotation more effectively?
  • HymloeHymloe Member Posts: 1,653
    I found a sort of a solution, by just using a timer every second, to Interpolate the camera origin to 0,0 over about 0.5 seconds. So, if the camera is ever away from the origin (because the player has gone to Landscape mode for example), then the camera will shift across the the origin again.

    Works OK. But I think I'll give up on the game supporting all four orientations, for other reasons. :)

    Rock on.
Sign In or Register to comment.