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 "Menu"
|
||||||
import "Saws"
|
import "Saws"
|
||||||
import "Editor"
|
import "Editor"
|
||||||
|
import "endless"
|
||||||
|
|
||||||
mode = "menu"
|
mode = "menu"
|
||||||
map = "data/level.rocketbyte"
|
map = "data/level.rocketbyte"
|
||||||
|
@ -87,7 +88,7 @@ menuButton, error = menu:addMenuItem("game menu", function()
|
||||||
song:play()
|
song:play()
|
||||||
end
|
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()
|
killPlayer()
|
||||||
removeMap()
|
removeMap()
|
||||||
killBlades()
|
killBlades()
|
||||||
|
@ -128,6 +129,9 @@ end
|
||||||
song:play(0)
|
song:play(0)
|
||||||
|
|
||||||
function playdate.update()
|
function playdate.update()
|
||||||
|
if mode == 'endless' then
|
||||||
|
processEndless()
|
||||||
|
end
|
||||||
if mode == "menu" then
|
if mode == "menu" then
|
||||||
updateMenu()
|
updateMenu()
|
||||||
processExplosions()
|
processExplosions()
|
||||||
|
@ -139,11 +143,16 @@ function playdate.update()
|
||||||
processEndCutscene()
|
processEndCutscene()
|
||||||
elseif mode == "music" then
|
elseif mode == "music" then
|
||||||
updateBox()
|
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)
|
song:setVolume(0.5)
|
||||||
updatePlayer()
|
updatePlayer()
|
||||||
gfx.sprite.update()
|
gfx.sprite.update()
|
||||||
|
|
||||||
|
if getFollow() == true then
|
||||||
processStars(sprRocket.x-210,sprRocket.y-130)
|
processStars(sprRocket.x-210,sprRocket.y-130)
|
||||||
|
else
|
||||||
|
processStars(0,0)
|
||||||
|
end
|
||||||
processExplosions()
|
processExplosions()
|
||||||
|
|
||||||
local ox, oy = gfx.getDrawOffset()
|
local ox, oy = gfx.getDrawOffset()
|
||||||
|
|
|
@ -53,7 +53,7 @@ function addMap(_file, rs)
|
||||||
grav = level.grav or 0.2
|
grav = level.grav or 0.2
|
||||||
if level.next then next = level.next end
|
if level.next then next = level.next end
|
||||||
if level.tutorial then tutorial = level.tutorial 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:remove()
|
||||||
sprTiles = gfx.sprite.new(tilemap)
|
sprTiles = gfx.sprite.new(tilemap)
|
||||||
|
|
|
@ -232,6 +232,8 @@ function menuButtonPress(name, index)
|
||||||
map = "data/H1. CAVEYARD.json"
|
map = "data/H1. CAVEYARD.json"
|
||||||
addMapSave("data/H1. CAVEYARD.json")
|
addMapSave("data/H1. CAVEYARD.json")
|
||||||
end
|
end
|
||||||
|
elseif name == "ENDLESS" then
|
||||||
|
startEndless()
|
||||||
|
|
||||||
elseif name == "CONTINUE" then
|
elseif name == "CONTINUE" then
|
||||||
addMap(map)
|
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"
|
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
|
if isPlus then
|
||||||
m[8] = "START PLUS GAME"
|
m[8], m[9] = "START PLUS GAME", "ENDLESS"
|
||||||
end
|
end
|
||||||
|
|
||||||
if playdate.file.exists("bonusLevels.rocketbytes") then
|
if playdate.file.exists("bonusLevels.rocketbytes") then
|
||||||
|
@ -321,7 +323,7 @@ function menuButtonPress(name, index)
|
||||||
local m = {}
|
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"
|
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
|
if isPlus then
|
||||||
m[8] = "START PLUS GAME"
|
m[8], m[9] = "START PLUS GAME", "ENDLESS"
|
||||||
end
|
end
|
||||||
if playdate.file.exists("bonusLevels.rocketbytes") then
|
if playdate.file.exists("bonusLevels.rocketbytes") then
|
||||||
m[6] = "EXTRA LEVELS"
|
m[6] = "EXTRA LEVELS"
|
||||||
|
@ -336,14 +338,14 @@ function menuButtonPress(name, index)
|
||||||
setLogoPos()
|
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"
|
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
|
if isPlus then
|
||||||
m[8] = "START PLUS GAME"
|
m[8], m[9] = "START PLUS GAME", "ENDLESS"
|
||||||
end
|
end
|
||||||
createMenu(m)
|
createMenu(m)
|
||||||
elseif menu == "qrs" or menu == "data" or menu == "dat" then
|
elseif menu == "qrs" or menu == "data" or menu == "dat" then
|
||||||
local m = {}
|
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"
|
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
|
if isPlus then
|
||||||
m[8] = "START PLUS GAME"
|
m[8], m[9] = "START PLUS GAME", "ENDLESS"
|
||||||
end
|
end
|
||||||
createMenu(m)
|
createMenu(m)
|
||||||
barpos = 160
|
barpos = 160
|
||||||
|
|
|
@ -4,6 +4,12 @@ grav = 0.2
|
||||||
scale = 1
|
scale = 1
|
||||||
local dead = false
|
local dead = false
|
||||||
|
|
||||||
|
local follow = false
|
||||||
|
|
||||||
|
function getFollow()
|
||||||
|
return follow
|
||||||
|
end
|
||||||
|
|
||||||
local rocketfly = nil
|
local rocketfly = nil
|
||||||
|
|
||||||
local exists = false
|
local exists = false
|
||||||
|
@ -51,13 +57,18 @@ local function die()
|
||||||
sfxDie:play()
|
sfxDie:play()
|
||||||
end
|
end
|
||||||
|
|
||||||
function addPlayer(_x,_y,__x,__y)
|
function addPlayer(_x,_y,__x,__y, camfollow)
|
||||||
exists = true
|
exists = true
|
||||||
dead = false
|
dead = false
|
||||||
scale = 1
|
scale = 1
|
||||||
active = false
|
active = false
|
||||||
sprSpawn:add()
|
sprSpawn:add()
|
||||||
sprSpawn:moveTo(_x,_y)
|
sprSpawn:moveTo(_x,_y)
|
||||||
|
if camfollow ~= nil then
|
||||||
|
follow = camfollow
|
||||||
|
else
|
||||||
|
follow = true
|
||||||
|
end
|
||||||
|
|
||||||
velocity = {x=0,y=0}
|
velocity = {x=0,y=0}
|
||||||
startpos = {x= _x,y=_y}
|
startpos = {x= _x,y=_y}
|
||||||
|
@ -184,8 +195,10 @@ function updatePlayer()
|
||||||
end
|
end
|
||||||
sprRocket:moveBy(velocity.x,velocity.y)
|
sprRocket:moveBy(velocity.x,velocity.y)
|
||||||
|
|
||||||
|
if follow then
|
||||||
local cx, cy = gfx.getDrawOffset()
|
local cx, cy = gfx.getDrawOffset()
|
||||||
gfx.setDrawOffset(playdate.math.lerp(cx,(-sprRocket.x + 200), lerpmnt), playdate.math.lerp(cy,(-sprRocket.y + 120), lerpmnt))
|
gfx.setDrawOffset(playdate.math.lerp(cx,(-sprRocket.x + 200), lerpmnt), playdate.math.lerp(cy,(-sprRocket.y + 120), lerpmnt))
|
||||||
|
end
|
||||||
|
|
||||||
sprRocket:setRotation(0)
|
sprRocket:setRotation(0)
|
||||||
sprRocket:update()
|
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
|
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
|
active = true
|
||||||
end
|
end
|
||||||
|
if follow then
|
||||||
local cx, cy = gfx.getDrawOffset()
|
local cx, cy = gfx.getDrawOffset()
|
||||||
gfx.setDrawOffset(playdate.math.lerp(cx,(-sprRocket.x + 200), lerpmnt), playdate.math.lerp(cy,(-sprRocket.y + 120), lerpmnt))
|
gfx.setDrawOffset(playdate.math.lerp(cx,(-sprRocket.x + 200), lerpmnt), playdate.math.lerp(cy,(-sprRocket.y + 120), lerpmnt))
|
||||||
|
end
|
||||||
elseif dead == true then
|
elseif dead == true then
|
||||||
|
if follow then
|
||||||
local cx, cy = gfx.getDrawOffset()
|
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))
|
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())
|
sprBigRocket:setImage(loopBigFire:image())
|
||||||
if scale > 0.1 then
|
if scale > 0.1 then
|
||||||
scale -= 0.05
|
scale -= 0.05
|
||||||
|
@ -224,6 +241,19 @@ function updatePlayer()
|
||||||
if active and inp then
|
if active and inp then
|
||||||
sprRocket:setImage(loopFire:image())
|
sprRocket:setImage(loopFire:image())
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
function updateExit()
|
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