setSequence is not working

My code:

local octopusSheetInfo1 = require( "img.share.octopus.octopus1" ) local octopusImageSheet1 = graphics.newImageSheet( "img/share/octopus/octopus1.png", octopusSheetInfo1:getSheet()) local octopusSheetInfo2 = require( "img.share.octopus.octopus2" ) local octopusImageSheet2 = graphics.newImageSheet( "img/share/octopus/octopus2.png", octopusSheetInfo2:getSheet()) local octopusSheetInfo3 = require( "img.share.octopus.octopus3" ) local octopusImageSheet3 = graphics.newImageSheet( "img/share/octopus/octopus3.png", octopusSheetInfo3:getSheet()) local octopusSheetInfo4 = require( "img.share.octopus.octopus4" ) local octopusImageSheet4 = graphics.newImageSheet( "img/share/octopus/octopus4.png", octopusSheetInfo4:getSheet()) local octopusData = {   {sheet = "octopusImageSheet1", name = "octopus1", frames  = {1,2,3,4}, time = 200, loopCount = 0, loopDirection = "forward"},   {sheet = "octopusImageSheet2", name = "octopus2", frames  = {1,2,3,4}, time = 200, loopCount = 0, loopDirection = "forward"},   {sheet = "octopusImageSheet3", name = "octopus3", frames  = {1,2,3,4}, time = 200, loopCount = 0, loopDirection = "forward"},   {sheet = "octopusImageSheet4", name = "octopus4", frames  = {1,2,3,4}, time = 200, loopCount = 0, loopDirection = "forward"}, } local octopusAnimation = display.newSprite( octopusImageSheet1, octopusData ) octopusAnimation.x,octopusAnimation.y = \_W/2,\_H/2 octopusAnimation:setSequence ( "octopus4" ) octopusAnimation:setFrame ( 1 ) print("sequnce: " .. tostring(octopusAnimation.sequence)) --sequnce: octopus4 octopusAnimation:play()

As a result, I see an animation from octopusImageSheet1.

If I replace in {sheet = “octopusImageSheet4”, name = “octopus4”, frames  = {1,2,3,4}, time = 200, loopCount = 0, loopDirection = “forward”} frames  = {1,2,3,4} with frames  = {1,2} I’ll see that the animation becomes 2 frames, but the imageSheet is taken from octopusImageSheet1 and not from octopusImageSheet4.

What is the problem?

I’m pretty sure this feature is working fine.

To help us help you debug this, please

  1. Make a small test case (config.lua, build.settings, main.lua, and your sprite sheet and sprite lua file)

Tip: You can use this template as a starter if you want:

https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/askEdStarter.zip

Just add your sprite PNG and Lua file, then modify main.lua to show this feature is not working for you.

  1. Zip it up, and attach it here (click More Reply Options Below)

attaching_files.jpg

I’m pretty sure this feature is working fine.

To help us help you debug this, please

  1. Make a small test case (config.lua, build.settings, main.lua, and your sprite sheet and sprite lua file)

Tip: You can use this template as a starter if you want:

https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/askEdStarter.zip

Just add your sprite PNG and Lua file, then modify main.lua to show this feature is not working for you.

  1. Zip it up, and attach it here (click More Reply Options Below)

attaching_files.jpg