sprite multiset animation sequence error

I have this code where I load 5 different sprite sheet images, which were previously just one big sprite sheet image, and I am trying to create a sprite set using the function newSpriteMultiSet(), but I can't seem to get it to work run :(

Here's the code by the way:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
      local idleData        = require("buchokoy_idle")
      local cryData         = require("buchokoy_cry")
      local runData         = require("buchokoy_run")
      local moveElbowData   = require("buchokoy_move_elbow")
      local moveLegData     = require("buchokoy_move_leg")
      
      local spriteIdle        = sprite.newSpriteSheetFromData( "buchokoy_idle.png",       idleData.getSpriteSheetData() )
      local spriteCry         = sprite.newSpriteSheetFromData( "buchokoy_cry.png",        cryData.getSpriteSheetData() )
      local spriteRun         = sprite.newSpriteSheetFromData( "buchokoy_run.png",        runData.getSpriteSheetData() )
      local spriteMoveElbow   = sprite.newSpriteSheetFromData( "buchokoy_move_elbow.png", moveElbowData.getSpriteSheetData() )
      local spriteMoveLeg     = sprite.newSpriteSheetFromData( "buchokoy_move_leg.png",   moveLegData.getSpriteSheetData() )
        
      -- SPRITE SETS. ADD THE MULTI SET ON DECIDED THE ORDER OF FRAMES
      local BUCHOKOY_SET = sprite.newSpriteMultiSet(
                              { sheet = spriteCry,        frames = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 } },
                              { sheet = spriteMoveElbow,  frames = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 } },
                              { sheet = spriteIdle,       frames = { 1, 2 } },
                              { sheet = spriteMoveLeg,    frames = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 } },
                              { sheet = spriteRun,        frames = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 } }
                            )
      
      -- ADD THE SPRITE SEQUENCES
      sprite.add(BUCHOKOY_SET, "cryStart",    1,  12, 600,    1) 
      sprite.add(BUCHOKOY_SET, "cryLoop",     12, 2,  500,    0)
      sprite.add(BUCHOKOY_SET, "elbowLeft",   14, 8,  320,    1)
      sprite.add(BUCHOKOY_SET, "elbowRight",  22, 8,  320,    1)
      sprite.add(BUCHOKOY_SET, "idle",        30, 1,  100,    0)
      sprite.add(BUCHOKOY_SET, "legLeft",     32, 6,  350,    1)
      sprite.add(BUCHOKOY_SET, "legRight",    38, 6,  350,    1)
      sprite.add(BUCHOKOY_SET, "run",         44, 12, 1200,   0)
       
      -- MAIN SPRITE INSTANCE
      local BUCHOKOY = sprite.newSprite(BUCHOKOY_SET)
            BUCHOKOY:setReferencePoint(display.CenterReferencePoint)
            BUCHOKOY.x = 2+170; BUCHOKOY.y = display.contentHeight-85-2      
            BUCHOKOY:prepare("idle")
            BUCHOKOY:play()
      localGroup:insert(BUCHOKOY)

I am having a similar issue - did you ever get this one resolved?

I think the problem is you need to encase that with another set of curly braces. like so.

1
2
3
4
5
6
7
8
9
10
    -- SPRITE SETS. ADD THE MULTI SET ON DECIDED THE ORDER OF FRAMES
      local BUCHOKOY_SET = sprite.newSpriteMultiSet(
                      {
                              { sheet = spriteCry,        frames = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 } },
                              { sheet = spriteMoveElbow,  frames = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 } },
                              { sheet = spriteIdle,       frames = { 1, 2 } },
                              { sheet = spriteMoveLeg,    frames = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 } },
                              { sheet = spriteRun,        frames = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 } }
                       }
       )
views:998 update:2011/10/22 17:28:16
corona forums © 2003-2011