Here’s the function. Thanks in advance!
local function cow (event) local sheetData = {width = 100,height = 100,numFrames = 8,sheetContentWidth = 200,sheetContentHeight = 400} local mySheet = graphics.newImageSheet ("CowWalk.png",sheetData) local sequenceData = {name = "cowOne",start = 1,count = 8,time = 950,loopcount = 0,looDirection = "forward"} cowOne = display.newSprite (mySheet,sequenceData) cowOne.x = 35 cowOne.y = 300 cowOne.rotation = 90 cowOne:play() end local function cowSpawnOne (event) for i = 0,0 do cow() cowOne.x = 35 cowOne.y = math.random (600,800) cowOneMovement = transition.to (cowOne,{time = 21000,y = -20}) if cowOne.y == -20 then cowOne:removeSelf() cowOne = nil return true end end end