Hi,
Hopefully I'm in the correct forum, but feel free to direct me otherwise.
I'm been developing a small and simple game targeted to mobile devices.
I've just finished all the logic, so now I'm more focused on the graphics part. My first dilemma is to understand how to resize the game to have the same aspect, on basically any mobile screen in the portrait mode.
I'm using a 480x850 stage in Flash and calling a document class that I'm developing in FlashDevelop.
The interesting thing I saw was that if I use the methods to detect the screen size, I can't make the game appear correctly. Some objects will show very big and/or outside the screen boundaries. The positions that are randomly generated are based on the following code:
_stageWidth = Math.min(stage.fullScreenWidth, _screenBounds.width);
_stageHeight = Math.min(stage.fullScreenHeight, _screenBounds.height);
Running in Flash, these give me what I have 480x850 (expected). When running on the device (HTC ONE M8) returns 1080x1776 (360dpi) [according to GSMArena this has 1080x1920-441dpi] and objects will completely or partially be off screen.
If I use the following code:
_stageWidth = Math.min(stage.fullScreenWidth, _screenBounds.width, stage.stageWidth);
_stageHeight = Math.min(stage.fullScreenHeight, _screenBounds.height, stage.stageHeight);
It returns the dimensions of the stage in Flash which works well for this purpose.
I guess my questions are:
1. Since I have enabled the "fullscreen" in the AIR settings in Flash, and I get the total available screen size from the phone and make the objects positions based on that, why do objects go beyond the visible boundaries?
2.Maybe it has something to do with the DPI, but how can I calculate the correct positions for these?
I'm using AIR 15 on Flash CS6.
I have checked this article which basically explains it, I find my results confusing.
Thanks!