Hello,
My question is about handling HD resources on standard definition devices without breaking positioning / physics. Thanks in advance for your time!
From a previous CC2D-iOS project, I’ve understood that:
iPhone (non-retina) :
- Screen height is 320px
- Use Normal textures > Character height is 100px
- Set scale factor to 1.0 so that the characters occupies */- 33 of screen height
- 1pt = 1 square px
Retina iPhone:
- Screen height is 640px
- Use HD textures > Character height is 200px
- Set scale factor to 2.0 so that the characters occupies +/- 33 of screen height
- 1pt = 2 square px
Result in both cases: - Set character 1 at 0,0
- Set character 2 at 0, 100
- Both characters touch but don’t overlap
Aside from migrating to CC2D-x/HTML5 The purpose is now to run the game on iPad . Following the same logic, I do the following : - Screen height is 768px
- Use Normal textures > Character height is 100px
- Set scale factor to 1.0 > character occupies*/- 13 of screen height
- 1pt = 1 square px
The character is too small, it should at least cover 20-25 of the screen height.
Attempt 1: Use HD textures and scale factor 1.0
- Character is larger (200 px) and occupies 26% of screen height, which is good.
- Positioning is broken: Set positions must be doubled, positions that I get must be halved before any processing happens.
- Physics is broken to: Mass is calculated based on the surface, must use a different pixel to meters ratio.
Result of attempt 1:
- Set character 1 at 0,0
- Set character 2 at 0, 100
- Both characters overlap (half of their surface does)
I’m looking the good way to handle this. Injecting scale factors based on device resolution in game logic doesn’t sound a clean solution.
- What is the usual way to deal with this?
- Is it possible to programmatically say “1pt = 2square px” so that coordinates system & physics are not broken?
Thanks!