无法创建工作精灵

Unable to create a working sprite

我无法为我的应用程序的这个单一区域创建工作动画精灵。

我正在使用 Corona SDK 并具有以下精灵:

这是名字 mainCharacter.png。我有一个双倍大小的版本,叫做 mainCharacter@2x.png

我有 sheet 个选项,2 个序列,我正在构建图像 sheet 并将其传递给我的精灵:

local playerSheetOptions =
{
    width = 50,
    height = 50,
    numFrames = 17,
    sheetContentWidth = 500,
    sheetContentHeight = 100
}
local playerSequences = {
    {
        name = "idle",
        start = 1,
        count = 12,
        time = 1200,
        loopCount = 0,
        loopDirection = "bounce"
    },
    {
        name = "jump",
        start = 13,
        count = 5,
        time = 600,
        loopCount = 1
    },
}
local playerSheet = graphics.newImageSheet( "resource/images/mainCharacter.png", playerSheetOptions )
local player = display.newSprite(gameSheet, playerSheet, playerSequences)

我收到以下错误:

display.newSprite() requires argument #2 to a table containing sequence data

如果我print相关数据:

print(gameSheet)
print(playerSheet)
print(playerSequences)

我得到:

14:27:05.703  userdata: 12445228
14:27:05.703  userdata: 0CF42600
14:27:05.703  table: 0CF41FD0

我哪里错了?我尝试了很多简化序列,但仍然得到相同的结果。

使用

local player = display.newSprite(playerSheet, playerSequences)

而不是

local player = display.newSprite(gameSheet, playerSheet, playerSequences)

来自科罗纳 documentation

Once the image sheet(s) and sequences are set up, a new sprite object can be created with the display.newSprite() API:

display.newSprite( [parent,] imageSheet, sequenceData )

For this API, the parent parameter is optional and represents the display group in which to insert the sprite. The imageSheet parameter defines the default image sheet for the sprite, and sequenceData is the table that contains all of the sequences for the sprite.

详细了解 Sprite Animation