begun endless, added more song
This commit is contained in:
parent
d7344ed04e
commit
a24690186a
6 changed files with 69 additions and 15 deletions
|
@ -20,6 +20,7 @@ import "Map"
|
|||
import "Menu"
|
||||
import "Saws"
|
||||
import "Editor"
|
||||
import "endless"
|
||||
|
||||
mode = "menu"
|
||||
map = "data/level.rocketbyte"
|
||||
|
@ -87,7 +88,7 @@ menuButton, error = menu:addMenuItem("game menu", function()
|
|||
song:play()
|
||||
end
|
||||
|
||||
if mode =="game" or mode == "play" or mode == "hgame" then
|
||||
if mode =="game" or mode == "play" or mode == "hgame" or mode == "endless" then
|
||||
killPlayer()
|
||||
removeMap()
|
||||
killBlades()
|
||||
|
@ -128,6 +129,9 @@ end
|
|||
song:play(0)
|
||||
|
||||
function playdate.update()
|
||||
if mode == 'endless' then
|
||||
processEndless()
|
||||
end
|
||||
if mode == "menu" then
|
||||
updateMenu()
|
||||
processExplosions()
|
||||
|
@ -139,11 +143,16 @@ function playdate.update()
|
|||
processEndCutscene()
|
||||
elseif mode == "music" then
|
||||
updateBox()
|
||||
elseif mode == "game" or mode == "play" or mode == "hgame" then
|
||||
elseif mode == "game" or mode == "play" or mode == "hgame" or mode == "endless" then
|
||||
song:setVolume(0.5)
|
||||
updatePlayer()
|
||||
gfx.sprite.update()
|
||||
processStars(sprRocket.x-210,sprRocket.y-130)
|
||||
|
||||
if getFollow() == true then
|
||||
processStars(sprRocket.x-210,sprRocket.y-130)
|
||||
else
|
||||
processStars(0,0)
|
||||
end
|
||||
processExplosions()
|
||||
|
||||
local ox, oy = gfx.getDrawOffset()
|
||||
|
|
|
@ -53,7 +53,7 @@ function addMap(_file, rs)
|
|||
grav = level.grav or 0.2
|
||||
if level.next then next = level.next end
|
||||
if level.tutorial then tutorial = level.tutorial end
|
||||
addPlayer(level.rocket.x+14,level.rocket.y+15, level.bigrocket.x+32, level.bigrocket.y+32)
|
||||
addPlayer(level.rocket.x+14,level.rocket.y+15, level.bigrocket.x+32, level.bigrocket.y+32, true)
|
||||
|
||||
sprTiles:remove()
|
||||
sprTiles = gfx.sprite.new(tilemap)
|
||||
|
|
|
@ -232,6 +232,8 @@ function menuButtonPress(name, index)
|
|||
map = "data/H1. CAVEYARD.json"
|
||||
addMapSave("data/H1. CAVEYARD.json")
|
||||
end
|
||||
elseif name == "ENDLESS" then
|
||||
startEndless()
|
||||
|
||||
elseif name == "CONTINUE" then
|
||||
addMap(map)
|
||||
|
@ -283,7 +285,7 @@ function menuButtonPress(name, index)
|
|||
|
||||
m[0],m[1], m[2], m[3], m[4], m[5], m[6],m[7]= "extras", "BACK","DEVELOPER","END CUTSCENE", "START CUTSCENE", "MUSIC BOX", "LEVEL SELECT", "START HALLOWEEN GAME"
|
||||
if isPlus then
|
||||
m[8] = "START PLUS GAME"
|
||||
m[8], m[9] = "START PLUS GAME", "ENDLESS"
|
||||
end
|
||||
|
||||
if playdate.file.exists("bonusLevels.rocketbytes") then
|
||||
|
@ -321,7 +323,7 @@ function menuButtonPress(name, index)
|
|||
local m = {}
|
||||
m[0],m[1], m[2], m[3], m[4], m[5], m[6],m[7] = "extras", "BACK","DEVELOPER","END CUTSCENE", "START CUTSCENE", "MUSIC BOX", "LEVEL SELECT", "START HALLOWEEN GAME"
|
||||
if isPlus then
|
||||
m[8] = "START PLUS GAME"
|
||||
m[8], m[9] = "START PLUS GAME", "ENDLESS"
|
||||
end
|
||||
if playdate.file.exists("bonusLevels.rocketbytes") then
|
||||
m[6] = "EXTRA LEVELS"
|
||||
|
@ -336,14 +338,14 @@ function menuButtonPress(name, index)
|
|||
setLogoPos()
|
||||
m[0],m[1], m[2], m[3], m[4], m[5], m[6],m[7] = "extras", "BACK","DEVELOPER","END CUTSCENE", "START CUTSCENE", "MUSIC BOX", "LEVEL SELECT", "START HALLOWEEN GAME"
|
||||
if isPlus then
|
||||
m[8] = "START PLUS GAME"
|
||||
m[8], m[9] = "START PLUS GAME", "ENDLESS"
|
||||
end
|
||||
createMenu(m)
|
||||
elseif menu == "qrs" or menu == "data" or menu == "dat" then
|
||||
local m = {}
|
||||
m[0],m[1], m[2], m[3], m[4], m[5], m[6],m[7] = "extras", "BACK","DEVELOPER","END CUTSCENE", "START CUTSCENE", "MUSIC BOX", "LEVEL SELECT", "START HALLOWEEN GAME"
|
||||
if isPlus then
|
||||
m[8] = "START PLUS GAME"
|
||||
m[8], m[9] = "START PLUS GAME", "ENDLESS"
|
||||
end
|
||||
createMenu(m)
|
||||
barpos = 160
|
||||
|
|
|
@ -4,6 +4,12 @@ grav = 0.2
|
|||
scale = 1
|
||||
local dead = false
|
||||
|
||||
local follow = false
|
||||
|
||||
function getFollow()
|
||||
return follow
|
||||
end
|
||||
|
||||
local rocketfly = nil
|
||||
|
||||
local exists = false
|
||||
|
@ -51,13 +57,18 @@ local function die()
|
|||
sfxDie:play()
|
||||
end
|
||||
|
||||
function addPlayer(_x,_y,__x,__y)
|
||||
function addPlayer(_x,_y,__x,__y, camfollow)
|
||||
exists = true
|
||||
dead = false
|
||||
scale = 1
|
||||
active = false
|
||||
sprSpawn:add()
|
||||
sprSpawn:moveTo(_x,_y)
|
||||
if camfollow ~= nil then
|
||||
follow = camfollow
|
||||
else
|
||||
follow = true
|
||||
end
|
||||
|
||||
velocity = {x=0,y=0}
|
||||
startpos = {x= _x,y=_y}
|
||||
|
@ -184,8 +195,10 @@ function updatePlayer()
|
|||
end
|
||||
sprRocket:moveBy(velocity.x,velocity.y)
|
||||
|
||||
local cx, cy = gfx.getDrawOffset()
|
||||
gfx.setDrawOffset(playdate.math.lerp(cx,(-sprRocket.x + 200), lerpmnt), playdate.math.lerp(cy,(-sprRocket.y + 120), lerpmnt))
|
||||
if follow then
|
||||
local cx, cy = gfx.getDrawOffset()
|
||||
gfx.setDrawOffset(playdate.math.lerp(cx,(-sprRocket.x + 200), lerpmnt), playdate.math.lerp(cy,(-sprRocket.y + 120), lerpmnt))
|
||||
end
|
||||
|
||||
sprRocket:setRotation(0)
|
||||
sprRocket:update()
|
||||
|
@ -201,11 +214,15 @@ function updatePlayer()
|
|||
if (playdate.buttonJustPressed(playdate.kButtonUp) or playdate.buttonJustPressed(playdate.kButtonDown) or playdate.buttonJustPressed(playdate.kButtonLeft) or playdate.buttonJustPressed(playdate.kButtonRight) or playdate.buttonJustPressed(playdate.kButtonA) or playdate.buttonJustPressed(playdate.kButtonB)) and playdate.isCrankDocked() == false then
|
||||
active = true
|
||||
end
|
||||
local cx, cy = gfx.getDrawOffset()
|
||||
gfx.setDrawOffset(playdate.math.lerp(cx,(-sprRocket.x + 200), lerpmnt), playdate.math.lerp(cy,(-sprRocket.y + 120), lerpmnt))
|
||||
if follow then
|
||||
local cx, cy = gfx.getDrawOffset()
|
||||
gfx.setDrawOffset(playdate.math.lerp(cx,(-sprRocket.x + 200), lerpmnt), playdate.math.lerp(cy,(-sprRocket.y + 120), lerpmnt))
|
||||
end
|
||||
elseif dead == true then
|
||||
local cx, cy = gfx.getDrawOffset()
|
||||
gfx.setDrawOffset(playdate.math.lerp(cx,(-sprRocket.x + 200), 0.1), playdate.math.lerp(cy,(-sprRocket.y + 120), 0.1))
|
||||
if follow then
|
||||
local cx, cy = gfx.getDrawOffset()
|
||||
gfx.setDrawOffset(playdate.math.lerp(cx,(-sprRocket.x + 200), 0.1), playdate.math.lerp(cy,(-sprRocket.y + 120), 0.1))
|
||||
end
|
||||
sprBigRocket:setImage(loopBigFire:image())
|
||||
if scale > 0.1 then
|
||||
scale -= 0.05
|
||||
|
@ -224,6 +241,19 @@ function updatePlayer()
|
|||
if active and inp then
|
||||
sprRocket:setImage(loopFire:image())
|
||||
end
|
||||
|
||||
if not follow then
|
||||
if sprRocket.y > 240 then
|
||||
sprRocket:moveTo(sprRocket.x, 0)
|
||||
elseif sprRocket.y < 0 then
|
||||
sprRocket:moveTo(sprRocket.x, 240)
|
||||
end
|
||||
if sprRocket.x > 400 then
|
||||
sprRocket:moveTo(0, sprRocket.y)
|
||||
elseif sprRocket.x < 0 then
|
||||
sprRocket:moveTo(400, sprRocket.y)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function updateExit()
|
||||
|
|
13
Source/endless.lua
Normal file
13
Source/endless.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
function startEndless()
|
||||
addPlayer(200,120,999,999, false)
|
||||
song:stop()
|
||||
song:load("sfx/song11")
|
||||
song:play(0)
|
||||
|
||||
mode = "endless"
|
||||
playdate.resetElapsedTime()
|
||||
end
|
||||
|
||||
function processEndless()
|
||||
deaths = playdate.getElapsedTime()
|
||||
end
|
Binary file not shown.
Loading…
Reference in a new issue