@2x graphics.newImageSheet

Hi you all, 

I tried to follow the tutorial that can be found at http://developer.coronalabs.com/forum/2010/12/08/dynamic-retina-spritesheets-heres-how, but in my game I’m using the graphics.newImageSheet  API instead of the  sprite.newSpriteSheet API. Furthermore, the  display.contentScaleX value changes as the phone’s resolution differs, so I cannot use this API if I want my game to run on various devices.

So could I know the right way to use @2x imageSheet?

The code I’m actually using is:

sheetRoma[1] = graphics.newImageSheet( "immagini/sfondoROMA/fiammaEfa.png", { width=36, height=17, numFrames=2 } ) roma[7] = display.newSprite( sheetRoma[1], { name="fiammaEfa2", start=1, count=2, time=velocitaFiammaEfa1 } ) roma[7].timeScale = 1.0 roma[7].x = roma[6].x - 154/2 roma[7].y = roma[6].y+20/2 roma[7].xScale = -0.6 roma[7].yScale = 0.6 roma[7].alpha = 0 roma[7]:play() roma[7].myName = "fiammaEfa2" roma[7].isFixedRotation=true roma[7].isSleepingAllowed = false

Thanks a lot

Hi @estiennelorenzo,

I can help with a few issues here:

  1. First, please read the guide on image sheets, especially the section “Dynamically-Selected Image Sheets”. This shows how to use image sheets for dynamic content scaling.

http://docs.coronalabs.com/guide/media/imageSheets/index.html

  1. If using physics, you should not scale objects using “.xScale”, “.yScale”, or “:scale()”. These do not adapt nicely to physical objects, because the image will scale in size, but the internal physical body will not.

Hope this helps,

Brent

Thank you Brent I’ve found everything I needed in the guide you have posted!

Hi @estiennelorenzo,

I can help with a few issues here:

  1. First, please read the guide on image sheets, especially the section “Dynamically-Selected Image Sheets”. This shows how to use image sheets for dynamic content scaling.

http://docs.coronalabs.com/guide/media/imageSheets/index.html

  1. If using physics, you should not scale objects using “.xScale”, “.yScale”, or “:scale()”. These do not adapt nicely to physical objects, because the image will scale in size, but the internal physical body will not.

Hope this helps,

Brent

Thank you Brent I’ve found everything I needed in the guide you have posted!