Skip to main content
Known Participant
March 6, 2012
Answered

Pixel distances in different devices

  • March 6, 2012
  • 1 reply
  • 443 views

I understand how you can develop for retina, and then on the older phones the graphics are scalled down to fit the smaller 320x480 screen, what I don't understand though is how that applies to pixel distances. Let's say I want to move a sprite 60 pixels along the x axis, and I'm designing my game for retina, doesn't that mean my sprite is now moving double as far as it needs to on the older phones? so does that mean I have to scale my pixel distance values as well? and therefore check for the smaller screen size so I can know to scale values?

This topic has been closed for replies.
Correct answer Colin Holgate

If you do things the hard way, and set the stage to not scale, you need to do all of the arithmetic yourself. If you leave the scaling at the default value, Flash will scale the stage for you, without affecting pixel distances. So, you could have a 960x640 stage, do all of your calculations based on that, and it will work fine on a non-Retina display.

1 reply

Colin Holgate
Colin HolgateCorrect answer
Inspiring
March 6, 2012

If you do things the hard way, and set the stage to not scale, you need to do all of the arithmetic yourself. If you leave the scaling at the default value, Flash will scale the stage for you, without affecting pixel distances. So, you could have a 960x640 stage, do all of your calculations based on that, and it will work fine on a non-Retina display.

March 6, 2012

Yes Colin's way makes it so you can code it as if its for the desktop and then the math will be adjusted as Flash scales it for different devices. But if you manually scale the stage you can come up with a unit system something like this

var myUnit = stage.stageWidth / 10;

so one unit is 1/10th of the stage width and then base your stuff on that, or you can deal with real life dimensions by checking the device DPI.