Hi all. I am new to corona and game coding in general . I have managed to implement Jumper into my game and I am now trying to set up character animation based on the character moving. The following 2 functions are what handle this. However I can not seem to get the sequence to change, any help would be appreciated.
function setPlayerAnimationSequence(sx, sy, x, y) player.asset:pause() if x \> sx then player.asset:setSequence( "move\_left" ) print("move\_left") elseif x \< sx then player.asset:setSequence( "move\_right" ) print("move\_right") elseif y \> sy then player.asset:setSequence( "move\_down" ) print("move\_down") elseif y \< sy then player.asset:setSequence( "move\_up" ) print("move\_up") end player.asset:play() end -- "movePlayer()" function movePlayer() local function movePlayerEnded() isCurrentlyMoving = false startX, startY = endX, endY player.asset:pause() end isCurrentlyMoving = true -- Calculate using Jumper Pathfinding local path = myFinder:getPath(startX, startY, endX, endY) local delay = 0 local time = 300 local pathcount = 0 if path then for node, count in path:nodes() do pathcount = pathcount + 1 transition.to( player.asset, {delay = delay, time = time, x = (node.x \* gridAssetSize) - 32 , y = (node.y \* gridAssetSize) - 32} ) --setPlayerAnimationSequence(startX, startY, node.x, node.y) timer.performWithDelay( delay, setPlayerAnimationSequence(startX, startY, node.x, node.y) ) delay = delay + time end timer.performWithDelay( pathcount \* time, movePlayerEnded ) end end