first commit
This commit is contained in:
commit
8fc9ebd0bf
6 changed files with 132 additions and 0 deletions
72
Main.lua
Normal file
72
Main.lua
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
local gfx <const> = playdate.graphics
|
||||||
|
local disp <const> = playdate.display
|
||||||
|
|
||||||
|
import "CoreLibs/object"
|
||||||
|
import "CoreLibs/graphics"
|
||||||
|
import "CoreLibs/sprites"
|
||||||
|
import "CoreLibs/math"
|
||||||
|
|
||||||
|
-- Music
|
||||||
|
local song1 <const> = playdate.sound.sampleplayer.new("sfx/song1")
|
||||||
|
-- Font Setup
|
||||||
|
local font <const> = gfx.font.new("gfx/font")
|
||||||
|
gfx.setFont(font)
|
||||||
|
-- Tilemap Setup
|
||||||
|
local tileTable <const> = gfx.imagetable.new("gfx/tiles")
|
||||||
|
local tilemap <const> = gfx.tilemap.new()
|
||||||
|
|
||||||
|
tilemap:setImageTable(tileTable)
|
||||||
|
tilemap:setSize(16,16)
|
||||||
|
tilemap:setTileAtPosition(2, 2, 2)
|
||||||
|
tilemap:setTileAtPosition(2, 10, 2)
|
||||||
|
|
||||||
|
gfx.sprite.addWallSprites(tilemap, {0,1})
|
||||||
|
|
||||||
|
local velocity = {x=0,y=0}
|
||||||
|
local lerpmnt <const> = 0.5
|
||||||
|
local grav <const> = 0.2
|
||||||
|
|
||||||
|
local imgRocket = gfx.image.new("gfx/rocket")
|
||||||
|
assert(imgRocket)
|
||||||
|
|
||||||
|
|
||||||
|
local sprRocket = gfx.sprite.new(imgRocket)
|
||||||
|
|
||||||
|
sprRocket:setCollideRect(7, 7, 14, 14)
|
||||||
|
sprRocket:add()
|
||||||
|
|
||||||
|
gfx.setBackgroundColor(gfx.kColorBlack)
|
||||||
|
|
||||||
|
song1:play(0, 1)
|
||||||
|
|
||||||
|
function playdate.update()
|
||||||
|
|
||||||
|
if playdate.buttonIsPressed(playdate.kButtonUp) then
|
||||||
|
velocity.x = velocity.x + math.sin(math.rad(playdate.getCrankPosition()))
|
||||||
|
velocity.y = velocity.y - math.cos(math.rad(playdate.getCrankPosition()))
|
||||||
|
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))
|
||||||
|
|
||||||
|
sprRocket:setRotation(0)
|
||||||
|
sprRocket:update()
|
||||||
|
print(#sprRocket:overlappingSprites())
|
||||||
|
|
||||||
|
sprRocket:setRotation(playdate.getCrankPosition())
|
||||||
|
|
||||||
|
velocity.y += grav
|
||||||
|
-- local stuff = sprRocket:allOverlappingSprites()
|
||||||
|
-- print(#stuff)
|
||||||
|
|
||||||
|
-- gfx.setDrawOffset(-sprRocket.x + 200, -sprRocket.y + 120)
|
||||||
|
gfx.clear(gfx.kColorBlack)
|
||||||
|
gfx.sprite.update()
|
||||||
|
tilemap:draw(2,1)
|
||||||
|
--gfx.drawText("AAAAAA LMAO 000 \nTEST",0,0)
|
||||||
|
end
|
||||||
|
|
||||||
|
function _draw()
|
||||||
|
|
||||||
|
end
|
60
gfx/font.fnt
Normal file
60
gfx/font.fnt
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
--metrics={"baseline":13,"xHeight":1,"capHeight":1,"pairs":{},"left":[],"right":[]}
|
||||||
|
datalen=1720
|
||||||
|
data=iVBORw0KGgoAAAANSUhEUgAAADgAAAA/CAYAAAC1gwumAAAE0ElEQVRoQ81ai3IjMQhr/v+j22S7uCBLgL15tDM3l1nHmIeQ8La3r7+fb/f55j7bx8e6em7fwXVl09tCu34Ps5vZRLdv5tD3/Wcs3n4fe2ePdfV8eBH3KZve1hfYDXuI3dTmHN3tCGI68Ijuz9lhFAIM+x57nLPhc7bGAjzP8f5OfoLNY91vMLudAE9bvIJnpQ/j6Cw7MAmWBuGQNCX0tE/bhgZoDwkcFURH8FD18FwhIpSIIKbaR1pmKsbImjOGl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Jdh25jTKkQEXtZySjHpFoA4KTZ8kpZpW2Hr2iqR6fTLFH4SezJLVHW+56W3qIJLESK1iT1LQ+Kii7CzAVwS/axNbbFS6CjDL6q4zr0ha8NOj4xMB7iatlRiE/icCbDmqiEv0rifDQESdAFXG/xtEKeFULJqNcbtQ291XJVQG6IX8mbpVaZZaf7oOVlrScXRMTpWxd6+r1wsVNMP6iG7+a/13x6MnmeafSKnJ4nieMNzHAr1cQUfnWyTw6sgzUsnYDv36l8E9nLxawZUkvLpYuQ5mv6YWU0Xox8Z3Phag6SC9mzWI49/C00M0y26lg1mCPlI1f+gPVcABnThC0roAAAAASUVORK5CYII=
|
||||||
|
width=7
|
||||||
|
height=9
|
||||||
|
|
||||||
|
tracking=1
|
||||||
|
|
||||||
|
0 7
|
||||||
|
1 7
|
||||||
|
2 7
|
||||||
|
3 7
|
||||||
|
4 7
|
||||||
|
5 7
|
||||||
|
6 7
|
||||||
|
7 7
|
||||||
|
8 7
|
||||||
|
9 7
|
||||||
|
space 6
|
||||||
|
<EFBFBD> 7
|
||||||
|
A 7
|
||||||
|
B 7
|
||||||
|
C 7
|
||||||
|
D 7
|
||||||
|
E 7
|
||||||
|
F 7
|
||||||
|
G 7
|
||||||
|
H 7
|
||||||
|
I 7
|
||||||
|
J 7
|
||||||
|
K 7
|
||||||
|
L 7
|
||||||
|
M 7
|
||||||
|
N 7
|
||||||
|
O 7
|
||||||
|
@ 2
|
||||||
|
P 7
|
||||||
|
Q 7
|
||||||
|
R 7
|
||||||
|
S 7
|
||||||
|
T 7
|
||||||
|
U 7
|
||||||
|
V 7
|
||||||
|
W 7
|
||||||
|
X 7
|
||||||
|
Y 7
|
||||||
|
Z 7
|
||||||
|
[ 4
|
||||||
|
] 4
|
||||||
|
\ 5
|
||||||
|
( 4
|
||||||
|
) 4
|
||||||
|
{ 4
|
||||||
|
| 3
|
||||||
|
} 4
|
||||||
|
~ 6
|
||||||
|
: 3
|
||||||
|
! 3
|
||||||
|
? 7
|
||||||
|
|
BIN
gfx/rocket.png
Normal file
BIN
gfx/rocket.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 218 B |
BIN
gfx/testimg.png
Normal file
BIN
gfx/testimg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
BIN
gfx/tiles-table-16-16.png
Normal file
BIN
gfx/tiles-table-16-16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 181 B |
BIN
sfx/song1.wav
Normal file
BIN
sfx/song1.wav
Normal file
Binary file not shown.
Loading…
Reference in a new issue