How to adapt a game app to all smartphone sizes?

ratio 9:18, 9:19.5, etc.

Set canvas.width to screen.height.

That way you have a square canvas.

Then, create a variable “ScreenSizer” which equals 0.5 x (canvas.width - screen.width)

Set your sprites’ X-position to: ScreenSizer + z% of screen width where z = where you want it on the screen.

Now it’ll be easier to position things.

2 Likes

not every game must have a canvas, and even if there is a canves, there are also elements outside.

Hey @dev_pro,

Your best protocol is to make use of percentages and responsive container sizes such as ‘fit’ & ‘fill’.

Do you have some screenshots of the app in its current state?