From f6ce215e3563105bc8b8a35cd4dcf7d2cd65f80a Mon Sep 17 00:00:00 2001 From: PossiblyAxolotl Date: Tue, 19 Apr 2022 15:31:46 -0600 Subject: [PATCH] optimised and minimised imports --- Source/Map.lua | 18 ++++++++++++++++++ Source/Player.lua | 3 ++- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 Source/Map.lua diff --git a/Source/Map.lua b/Source/Map.lua new file mode 100644 index 0000000..0901c79 --- /dev/null +++ b/Source/Map.lua @@ -0,0 +1,18 @@ +local tileTable = gfx.imagetable.new("gfx/tiles") +local tilemap = gfx.tilemap.new() + +tilemap:setImageTable(tileTable) +tilemap:setSize(100,100) + +function addMap(_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 \ No newline at end of file diff --git a/Source/Player.lua b/Source/Player.lua index 71b59c4..b610018 100644 --- a/Source/Player.lua +++ b/Source/Player.lua @@ -1,7 +1,8 @@ +import "CoreLibs/math" + local velocity = {x=0,y=0} local lerpmnt = 0.5 local grav = 0.2 -local gfx = playdate.graphics local active = false local imgRocket = gfx.image.new("gfx/rocket")