Corona SDK(Lua)Sprite Sheet动画

时间:2015-12-31 08:57:19

标签: animation lua sprite corona

我试图让精灵表运行4张图片,所以它播放动画,虽然Corona SDK给我一个错误说

" main.lua40:错误的论点#2到' newImageSheet' (表(选项)预期)    stack traceback:[C]:in function' newImageSheet' main.lua 40:在主要部分"

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)

感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

该项目保存在Corona样本下,如下图所示: 以及在此文件夹中:C:\ Program Files(x86)\ Corona Labs \ Corona SDK \ Sample Code \ Animation

您可以使用它作为基础,所以节省您一些时间。 enter image description here