changed rocketbytes to json, added launcher card
This commit is contained in:
parent
d77f00bab8
commit
8ce96aaba5
7 changed files with 47 additions and 11 deletions
|
@ -3,7 +3,7 @@ import "CoreLibs/sprites"
|
||||||
import "Player"
|
import "Player"
|
||||||
import "Map"
|
import "Map"
|
||||||
|
|
||||||
gfx <const> = playdate.graphics
|
local gfx <const> = playdate.graphics
|
||||||
local disp <const> = playdate.display
|
local disp <const> = playdate.display
|
||||||
|
|
||||||
local font <const> = gfx.font.new("gfx/font")
|
local font <const> = gfx.font.new("gfx/font")
|
||||||
|
@ -13,9 +13,9 @@ gfx.setBackgroundColor(gfx.kColorBlack)
|
||||||
local song1 <const> = playdate.sound.sampleplayer.new("sfx/song1")
|
local song1 <const> = playdate.sound.sampleplayer.new("sfx/song1")
|
||||||
song1:play(0, 1)
|
song1:play(0, 1)
|
||||||
|
|
||||||
addTiles("levels/level1.rocketbyte")
|
addMap("levels/level1.json")
|
||||||
|
|
||||||
addPlayer(10,10)
|
addPlayer(50,50)
|
||||||
|
|
||||||
function playdate.update()
|
function playdate.update()
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
local gfx <const> = playdate.graphics
|
||||||
local tileTable <const> = gfx.imagetable.new("gfx/tiles")
|
local tileTable <const> = gfx.imagetable.new("gfx/tiles")
|
||||||
local tilemap <const> = gfx.tilemap.new()
|
local tilemap <const> = gfx.tilemap.new()
|
||||||
|
|
||||||
tilemap:setImageTable(tileTable)
|
tilemap:setImageTable(tileTable)
|
||||||
tilemap:setSize(100,100)
|
tilemap:setSize(100,100)
|
||||||
|
|
||||||
|
|
|
@ -3,21 +3,39 @@ import "CoreLibs/math"
|
||||||
local velocity = {x=0,y=0}
|
local velocity = {x=0,y=0}
|
||||||
local lerpmnt <const> = 0.5
|
local lerpmnt <const> = 0.5
|
||||||
local grav <const> = 0.2
|
local grav <const> = 0.2
|
||||||
local active = false
|
|
||||||
|
|
||||||
|
local exists = false
|
||||||
|
local active = false
|
||||||
|
local gfx <const> = playdate.graphics
|
||||||
local imgRocket = gfx.image.new("gfx/rocket")
|
local imgRocket = gfx.image.new("gfx/rocket")
|
||||||
assert(imgRocket)
|
assert(imgRocket)
|
||||||
local sprRocket = gfx.sprite.new(imgRocket)
|
local sprRocket = gfx.sprite.new(imgRocket)
|
||||||
sprRocket:setCollideRect(7, 7, 14, 14)
|
sprRocket:setCollideRect(7, 7, 14, 14)
|
||||||
|
local startpos = {x=0,y=0}
|
||||||
|
|
||||||
function addPlayer(x,y)
|
function addPlayer(_x,_y)
|
||||||
active = true
|
exists = true
|
||||||
sprRocket:moveTo(x,y)
|
active = false
|
||||||
|
velocity = {x=0,y=0}
|
||||||
|
startpos = {x= _x,y=_y}
|
||||||
|
sprRocket:moveTo(_x,_y)
|
||||||
sprRocket:add()
|
sprRocket:add()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function killPlayer()
|
||||||
|
exists = false
|
||||||
|
active = false
|
||||||
|
sprRocket:remove()
|
||||||
|
end
|
||||||
|
|
||||||
|
local function die()
|
||||||
|
active = false
|
||||||
|
velocity = {x=0,y=0}
|
||||||
|
sprRocket:moveTo(startpos.x, startpos.y)
|
||||||
|
end
|
||||||
|
|
||||||
function updatePlayer()
|
function updatePlayer()
|
||||||
if active then
|
if active == true then
|
||||||
if playdate.buttonIsPressed(playdate.kButtonUp) then
|
if playdate.buttonIsPressed(playdate.kButtonUp) then
|
||||||
velocity.x = velocity.x + math.sin(math.rad(playdate.getCrankPosition()))
|
velocity.x = velocity.x + math.sin(math.rad(playdate.getCrankPosition()))
|
||||||
velocity.y = velocity.y - math.cos(math.rad(playdate.getCrankPosition()))
|
velocity.y = velocity.y - math.cos(math.rad(playdate.getCrankPosition()))
|
||||||
|
@ -31,8 +49,19 @@ function updatePlayer()
|
||||||
sprRocket:update()
|
sprRocket:update()
|
||||||
--print(#sprRocket:overlappingSprites())
|
--print(#sprRocket:overlappingSprites())
|
||||||
|
|
||||||
sprRocket:setRotation(playdate.getCrankPosition())
|
|
||||||
|
|
||||||
velocity.y += grav
|
velocity.y += grav
|
||||||
|
|
||||||
|
if #sprRocket:overlappingSprites() > 0 then
|
||||||
|
die()
|
||||||
|
end
|
||||||
|
|
||||||
|
elseif exists == true then
|
||||||
|
if playdate.buttonIsPressed(playdate.kButtonUp) 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))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sprRocket:setRotation(playdate.getCrankPosition())
|
||||||
end
|
end
|
BIN
Source/launcher/card.png
Normal file
BIN
Source/launcher/card.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 866 B |
7
Source/pdxinfo
Normal file
7
Source/pdxinfo
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
name=Rocket Bytes
|
||||||
|
author=PossiblyAxolotl
|
||||||
|
description=The sequel to Rocket Bits. Help a crew of rockets collect fuel to get back home!
|
||||||
|
bundleID=com.possiblyaxolotl.rocketbytes
|
||||||
|
version=1.0
|
||||||
|
buildNumber=1
|
||||||
|
imagePath=launcher
|
Loading…
Reference in a new issue