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?