Minimised and optimised imports

This commit is contained in:
PossiblyAxolotl 2022-04-19 15:32:18 -06:00
parent f6ce215e35
commit d77f00bab8
2 changed files with 5 additions and 29 deletions

View file

@ -1,21 +1,16 @@
local gfx <const> = playdate.graphics
local disp <const> = playdate.display
import "CoreLibs/object"
import "CoreLibs/graphics"
import "CoreLibs/sprites"
import "CoreLibs/math"
import "Player"
import "Tilemap"
import "Map"
gfx <const> = playdate.graphics
local disp <const> = playdate.display
-- Music
local song1 <const> = playdate.sound.sampleplayer.new("sfx/song1")
-- Font Setup
local font <const> = gfx.font.new("gfx/font")
gfx.setFont(font)
gfx.setBackgroundColor(gfx.kColorBlack)
local song1 <const> = playdate.sound.sampleplayer.new("sfx/song1")
song1:play(0, 1)
addTiles("levels/level1.rocketbyte")

View file

@ -1,19 +0,0 @@
local tileTable <const> = gfx.imagetable.new("gfx/tiles")
local tilemap <const> = gfx.tilemap.new()
local gfx <const> = playdate.graphics
tilemap:setImageTable(tileTable)
tilemap:setSize(100,100)
function addTiles(_file)
local level = json.decodeFile(_file)
for i = 1, #level.tiles, 1 do
tilemap:setTileAtPosition(level.tiles[i].x,level.tiles[i].y,level.tiles[i].t)
end
gfx.sprite.addWallSprites(tilemap, {0,1})
end
function drawTiles()
tilemap:draw(0,0)
end