Guys, i just realized if we change device in corona simulator (like from iphone 4 to ipad) then the object position will also change on the screen. Something like:
player.x = 40
player.y = 400
won’t look the same in different devices. I want to make them look great in different devices, what’s the best solution for the objects position? [import]uid: 114765 topic_id: 22235 reply_id: 322235[/import]
If you are scaling up it doesn’t exactly change position; have a read on dynamic scaling.
For this a great thing to do is to look at the Ghosts VS Monsters sample code; it shows an app that looks almost the same on iPad and iPhone and looks great
tbh i dont understand in ghosts vs monsters where’s the specific line that discuss about this…because i see the ghostObject.x and ghostObject.y is just using basic numbers
as for trueX and trueY, i think it doesn’t really change much. I still have an object that looks totally far in iPad (but looks OK in other devices)
i wonder if there’s special code to show different position for different devices like if device == ipad then bla bla and if device == nexus one then bla bla? [import]uid: 114765 topic_id: 22235 reply_id: 88621[/import]
Essentially, you set the content size to say 480 x 320, and it will scale up to larger screens where necessary, how it scales will depend on whether you select letterbox, zoomStretch or zoomEven.
Your x and y references are in relation to the content size, not the screen size, so there’s no need to have different values for different devices. [import]uid: 93133 topic_id: 22235 reply_id: 88635[/import]
i have read about dynamic content scaling. in fact i have tried to compare my config.lua with the ghost vs monster one and everything looked very similar and im still wondering why several of my objects look different in iPad (but yeah it looks perfect in other devices including android ones).
of course i use letterbox. i have tried zoomeven and it made it worse. Not sure about the others, what are the other options?
as for the originX and originY, i understand that but what to fill in local originX and local originY, really?
I put originX = display.contentWidth / 2
but apparently it doesn’t work? [import]uid: 114765 topic_id: 22235 reply_id: 88645[/import]
How do they look different, stretched/squashed, or just in the wrong place?
letterbox should give you a 320 x 480 stage, scaled up to 640 x 960 with black borders taking up the rest of the 768 x 1024 space on an iPad. Make sure you use newImageRect and have @2x images.
zoomStretch will fill the whole screen, so on an iPad objects will look wider (in portrait mode).
zoomEven will fill as much of the screen as possible without distorting the aspect ratio (i.e. circles stay as circles and don’t become ovals)
For some of my games I used zoomStretch because it didn’t matter that things were stretched a little on iPad, but my current project has a clock which I didn’t want to become oval-shaped so I’m using letterbox. I made the background big enough to cover all screen sizes, so on an iPhone some of it will be offscreen but on an iPad it fills the black borders. I also have a few text objects which change y position if it’s on iPad to use the extra space. [import]uid: 93133 topic_id: 22235 reply_id: 88654[/import]
@nick_sherman: i created floor that i want to put at the very bottom part of the screen but it went up a bit in iPad. However things work well with mmathias6410 trick [import]uid: 114765 topic_id: 22235 reply_id: 88669[/import]