How can I make a game that can be played in Portrait or Landscape modes?
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
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
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?
Works OK. But I think I'll give up on the game supporting all four orientations, for other reasons.
Rock on.