local gfx = playdate.graphics local imgClock = gfx.image.new("gfx/clock") local imgTrophy = gfx.image.new("gfx/trophy") local imgSand = gfx.image.new("gfx/hourglass") local lastActive = false local lastTime = 0 local tempDeaths function startEndless() addPlayer(200,120,999,999, false) song:stop() song:load("sfx/song11") song:play(0) mode = "endless" lastActive = false tempDeaths = deaths end function processEndless() local active = getActive() if not active and lastActive then -- just died deleteMoves() lastTime = playdate.getElapsedTime() elseif not lastActive and active then -- just started playdate.resetElapsedTime() addMoveSaw(0,30,90) end if active then deaths = tostring(playdate.getElapsedTime()) else deaths = tostring(lastTime).."\n12" imgTrophy:draw(1,20) end imgClock:draw(0,1) lastActive = active processMoveSaw() end function closeEndless() deaths = tempDeaths killPlayer() deleteMoves() end