Frame height being rounded up at runtime, throws runtime error

Hi, all. 

I’m working with a sprite sheet that is 417 pixels tall, has 6 frames and thus each frame is 69.5 pixels tall. 

When I or my audio designer run the game, it runs fine. When our artist runs the game, he gets a runtime error that indicates the frame height is 70 (not 69.5, which is how it’s listed in code and he does have the right code). 

For some reason, his set up seems to be rounding up the height from 69.5 to 70. My guess is since his setup is rounding the height up, this throws off all the math of cutting up the sprite sheet into 6 equal frames, thus resulting in the error. 

He is running a Windows machine while the audio designer and I are both running on Macs. Could this be related to the issue? 

In the meantime, I’m just going to adjust the sprite sheet to be 420 pixels so the frames can be 70 pixels tall and we thus avoid the rounding issue. But, I’d really like to understand more about what’s going on. 

Thanks!

Below is a snippet of the code we are all using: 

local splashEggBlinkOptions =

{

    width = 200,

    height = 69.5, --this is the number that his machine is interpreting as 70 pixels, at least in the runtime error message

    numFrames = 6,

    sheetContentWidth = 200,

    sheetContentHeight = 417 

}

local splashEggBlink_sheet = graphics.newImageSheet( “SplashEggBlinkAnimation.png”, splashEggBlinkOptions )

You can’t really have a fraction of a pixel when you are talking about the dimensions of an image. Think about any image or display resolution anywhere, they are all integers.

Corona will automatically scale your images depending on the current device’s resolution and your config.lua, so perhaps when your artist runs the game, he has a different test device selected, which results in different scaling for the image. I’m not sure as to why this resulting in a runtime error, perhaps someone else does. My recommendation would be to stick to integers when it comes to pixels, because fractions of pixels are impossible (when it comes to dimensions of an image).

You can’t really have a fraction of a pixel when you are talking about the dimensions of an image. Think about any image or display resolution anywhere, they are all integers.

Corona will automatically scale your images depending on the current device’s resolution and your config.lua, so perhaps when your artist runs the game, he has a different test device selected, which results in different scaling for the image. I’m not sure as to why this resulting in a runtime error, perhaps someone else does. My recommendation would be to stick to integers when it comes to pixels, because fractions of pixels are impossible (when it comes to dimensions of an image).