Hey,
I’m trying to change animation in existing object.
I’m creating object:
local objProps = { name = "cat" .. counter, x = 100, y = 100, assetName = "cat", xScale = 0.13, yScale = 0.13, followPathProps = {path = 'path\_18, direction = 1, rotate = false, rebound = true, repeats = -1, delay = 2, autoStart = true, xFlip = true, yFlip = false}, } local obj = myLevel:createObject("animals", objProps) obj.view.speed = math.random(1,4) obj.view:setSequence( "catWalk") obj.view:play() local path = myLevel:getLayerObject("animals", objProps.followPathProps.path) obj:followPath( path, objProps.followPathProps) animalsTable[1] = obj
then I get this object from the table and try to change sequence:
local obj = animalsTable[1] print("obj.assetName = " .. obj.assetName .. obj.view..sequence: " .. obj.view.sequence) -- output: obj.assetName = cat, obj.view..sequence: catWalk obj.name = "monster" .. counter obj.assetName = "monster" counter = counter + 1 obj.view:pause() -- I can stop the animation obj.view:setSequence( "monsterFly") obj.view:play() print("obj.assetName = " .. obj.assetName .. ", obj.view..sequence: " .. obj.view.sequence) -- output: obj.assetName = monster, obj.view..sequence: catWalk
I called obj.view:setSequence( “monsterFly”) but it doesnt change the sequence. There is still old value.