Adjust to android device size

Get help using Construct 2

Post » Thu Jul 18, 2013 1:09 pm

hey guys i'm having a lil prob.

I put my prog into an android device with ludei cloud compiling but whenever i put it on the tablet the baackground size is always a little small. Either in top, or bottom or left or right..


In the project size i've tried 1280x720 and 1280x1024 and in the layout size and margins the same thing. Any help?

Ty
B
7
S
1
Posts: 21
Reputation: 647

Post » Thu Jul 18, 2013 1:16 pm

B
20
S
6
G
4
Posts: 347
Reputation: 4,451

Post » Thu Jul 18, 2013 1:20 pm

It's very useful to get into the habit of coding resolution-independently. Set all UI element's positions by events, and always use some form of WindowWidth/Height or LayerLeft/Right/Bottom/Top in such a way as to not matter what the screen resolution is. For instance:

Every Tick
-> Set position of Sprite to WindowWidth/2, WindowHeight/2

This will ALWAYS, independent of screen resolution, make the sprite sit at the center of the user's screen.
B
55
S
12
G
9
Posts: 339
Reputation: 9,574

Post » Thu Jul 18, 2013 4:18 pm

I had a similar problem for my android app, the background (although the right size) was a little smaller on my tablet. I got around this by resizing the background to be bigger than than the exact size it was supposed to be.
B
72
S
25
G
10
Posts: 383
Reputation: 11,166


Return to How do I....?

Who is online

Users browsing this forum: Kyatric and 54 guests