Unable to load a polygon shape correctly

Hi guys, I am new to Corona SDK.

Currently I wanna render a button which is polygon shape. I put it in a big atlas and use Sprite Sheet to render it and cut it into frame. But the final result is not as what I expected. It only showed the rectangle shape of the polygon.

The final result

The expectation

My original sprite sheet

My code I used to load it

local menuSpriteSheet = { frames={ { x = 0, y = 0, width = 175, heigh = 150 }, { x = 175, y = 0, width = 244, heigh = 119 } } } local menuAtlas = graphics.newImageSheet("asset/ui-asset.png",menuSpriteSheet) local playBtnSprite = display.newImageRect(menuAtlas,2,244,119) playBtnSprite.x = display.contentCenterX playBtnSprite.y = display.contentCenterY

I tested out with single png file with another polygon shape and not using Image Sheet to load it, only use newImageRect and magically, I can load it. I am so confused at this case.
 

Hi @stephen.ho.232,

You misspelled the word. It shoud be ‘height’ not ‘heigh’.

Try (tested)

local menuSpriteSheet = {         frames={             {                 x     = 0,                 y     = 0,                 width = 102, --175,                 height = 87, --150             },             {                 x     = 103,--175,                 y     = 0,                 width = 230-103,--244,                 height = 69,--119             }         }     }     local menuAtlas = graphics.newImageSheet("thumb.png",menuSpriteSheet)     --local playBtnSprite = display.newImageRect(menuAtlas,2,244,119)     local playBtnSprite = display.newImageRect(menuAtlas,2,230-103,69)

Have a nice day:)

ldurniat

Thanks for help @Idurniat :D. It lit up my way of debug processing.