hayful59
hayful59

Reputation: 17

Corona SDK (Lua) Sprite Sheet Animations

Im trying to get a sprite sheet to run through the 4 images so it plays an animation, although Corona SDK is giving me an error saying

"main.lua40: bad argument #2 to 'newImageSheet' (table (options)expected) stack traceback: [C]: in function 'newImageSheet' main.lua 40: in main chunk"

exclamationMarkAnimations = graphics.newImageSheet("exclamationMarkAnimated.png", sheetOptions)

exclamationMarkAnimated =
{
    width = 12,
    height = 12,
    numFrames = 4
}

animation = {
  {
    name = "bobbing",
    start = 1,
    count = 4,
    time = 800,
    loopCount = 0, -- "0" means always
    loopDirection = "forward"
   }
}

exclamationMarkVars = display.newSprite(exclamationMarkAnimations, exclamationMarkAnimated)

exclamationMarkVars:addEventListener("sprite", spriteListener)

Thank you for any and all help.

Upvotes: 0

Views: 688

Answers (1)

Amir
Amir

Reputation: 1683

That project is saved under Corona samples as you can see in the picture below: and also in this folder: C:\Program Files (x86)\Corona Labs\Corona SDK\Sample Code\Animation

You can use that as the base so save you some time. enter image description here

Upvotes: 0

Related Questions