local soldier = display.newSprite(soldier\_sheet, walking\_soldier) soldier.x = display.contentCenterX soldier.y = display.contentCenterY local flagimage = display.newImageRect( "jobs.png", 60, 40 ) flagimage.x = 50 flagimage.y = 440 flagimage:toFront() local function spriteListener( event ) local thisSprite = event.target -- "event.target" references the sprite if ( event.phase == "ended" ) then thisSprite:setSequence( "speedWalk" ) -- This is where I'm getting the error thisSprite:play() -- play the new sequence end end -- add the event listener to the sprite flagimage:addEventListener( "touch", spriteListener ) sceneGroup:insert( background ) sceneGroup:insert( soldier ) sceneGroup:insert( flagimage )
Attempt to call method ‘setSequence’ (a nil value)
File: scene3.lua
Line: 71
I’m not sure what I’m doing wrong :/