Rocket-Bytes/Source/endless.lua

51 lines
1 KiB
Lua
Raw Normal View History

2024-03-09 05:24:13 +00:00
local gfx <const> = 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
2024-03-08 06:37:27 +00:00
function startEndless()
addPlayer(200,120,999,999, false)
song:stop()
song:load("sfx/song11")
song:play(0)
mode = "endless"
2024-03-09 05:24:13 +00:00
lastActive = false
tempDeaths = deaths
2024-03-08 06:37:27 +00:00
end
function processEndless()
2024-03-09 05:24:13 +00:00
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()
2024-03-08 06:37:27 +00:00
end