How can I do a SpriteObject:setFrame but then pass the “name” of the sprite frame I want not the index?
Background
* Have a spritesheet and lua file generated by TexturePacker
* in the lua file there is the use of “name”, however when I set the frame I have to pass the index
* the actual sprites within the texture file are out of order too, so it’s not as if the 2nd sprite image I added in TexturePacker to be included is actually 2nd in the lua file
currSprite:setFrame(spriteIndex)
local SpriteSheet = {}
SpriteSheet.getSpriteSheetData = function ()
return {
frames = {
{
name = "1.png",
spriteColorRect = { x = 20, y = 9, width = 12, height = 26 },
textureRect = { x = 114, y = 64, width = 12, height = 26 },
spriteSourceSize = { width = 50, height = 50 },
spriteTrimmed = true,
textureRotated = false
},
{
name = "10",
spriteColorRect = { x = 4, y = 6, width = 36, height = 30 },
textureRect = { x = 2, y = 66, width = 36, height = 30 },
spriteSourceSize = { width = 50, height = 50 },
spriteTrimmed = true,
textureRotated = false
},
[import]uid: 140210 topic_id: 29024 reply_id: 329024[/import]