From d48044f5a6267fcacb1a5013c628b053ec5e8f07 Mon Sep 17 00:00:00 2001 From: PossiblyAxolotl Date: Thu, 16 Jun 2022 17:24:35 -0600 Subject: [PATCH] collisions died --- Source/Editor.lua | 54 +++++++++++++++++++++++++------ Source/Map.lua | 1 + Source/Saws.lua | 1 + Source/launcher/card-pressed.png | Bin 0 -> 1591 bytes 4 files changed, 46 insertions(+), 10 deletions(-) create mode 100644 Source/launcher/card-pressed.png diff --git a/Source/Editor.lua b/Source/Editor.lua index 2a554c8..c9bc25e 100644 --- a/Source/Editor.lua +++ b/Source/Editor.lua @@ -12,6 +12,7 @@ local tilemapEditor = gfx.tilemap.new() tilemapEditor:setImageTable(tileTable) local tiles = {} local sawblades = {} +local spins = {} tilemapEditor:setSize(1000,1000) local imgtiles = gfx.sprite.new(tilemapEditor) @@ -153,10 +154,12 @@ local curYlerp = -32 function editSave() playdate.datastore.delete("levels/"..levelname..".json") saveTime = 5 - playdate.datastore.write({tiles = tiles, inverted = inverted, rocket=playerPos, bigrocket=exitPos, fuel = powers,saws=sawblades,rotators={}},"levels/"..levelname) + playdate.datastore.write({tiles = tiles, inverted = inverted, rocket=playerPos, bigrocket=exitPos, fuel = powers,saws=sawblades,rotators=spins},"levels/"..levelname) end local traveltime = 1 +local armamount = 1 +local armlength = 1 function editUpdate() --print(math.floor( tileIndex ) ) @@ -175,9 +178,12 @@ function editUpdate() curY = (math.floor( tileIndex ) % 8) * 28 +7 elseif editor == "pos2Saw" then - traveltime += change * 0.003 + traveltime += change * 0.002 if traveltime < 0.2 then traveltime = 0.2 end traveltime = tonumber(string.format("%.2f", traveltime)) + elseif editor == "pos2Spin" then + traveltime += change * 0.002 + traveltime = tonumber(string.format("%.2f", traveltime)) end curYlerp = playdate.math.lerp(curYlerp, curY, 0.4) @@ -188,8 +194,10 @@ function editUpdate() if editor == "pos2Saw" then sawblades[#sawblades+1] = {start={x=pos1.x,y=pos1.y},ends = {x=(position.x + 11) * 16,y=(position.y + 7) * 16}, speed = traveltime} editor = "main" - printTable(sawblades[#sawblades]) - tileIndex = 2 + elseif editor == "pos2Spin" then + spins[#spins+1] = {middle=true,x=pos1.x,y=pos1.y,speed=traveltime,arms=armamount,armlen=armlength} + editor = "main" + printTable(spins[#spins]) elseif editor == "tiles" then if math.floor( tileIndex ) == 0 then editor = "main" @@ -209,9 +217,13 @@ function editUpdate() elseif math.floor(tileIndex) == 1 then powers[#powers+1] = {x=((position.x + 11) * 16)-7, y=((position.y + 7) * 16)-5} elseif math.floor(tileIndex) == 2 then + traveltime = 1 pos1.x,pos1.y=((position.x + 11) * 16), ((position.y + 7) * 16) editor = "pos2Saw" elseif math.floor( tileIndex ) == 3 then + traveltime = 1 + armamount = 1 + armlength = 1 pos1.x,pos1.y=((position.x + 11) * 16), ((position.y + 7) * 16) editor = "pos2Spin" elseif math.floor(tileIndex) == 4 then @@ -234,9 +246,11 @@ function editUpdate() end end elseif editor == "pos2Saw" then - pos1 = nil tileIndex = 2 editor = "main" + elseif editor == "pos2Spin" then + tileIndex = 3 + editor = "main" elseif editor == "main" then --[[if math.floor( tileIndex ) == 0 then tilemapEditor:setTileAtPosition(position.x+12,position.y+8,0) @@ -269,14 +283,32 @@ function editUpdate() end if playdate.buttonJustPressed(playdate.kButtonLeft) then - position.x -= 1 + if editor ~= "pos2Spin" then + position.x -= 1 + else + armamount-=1 + if armamount < 1 then armamount = 1 end + end elseif playdate.buttonJustPressed(playdate.kButtonRight) then - position.x += 1 + if editor ~= "pos2Spin" then + position.x += 1 + else + armamount+=1 + end end if playdate.buttonJustPressed(playdate.kButtonUp) then - position.y -= 1 + if editor ~= "pos2Spin" then + position.y -= 1 + else + armlength += 1 + end elseif playdate.buttonJustPressed(playdate.kButtonDown) then - position.y += 1 + if editor ~= "pos2Spin" then + position.y += 1 + else + armlength-=1 + if armlength < 1 then armlength = 1 end + end end if position.x + 11 < 0 then position.x = -11 end @@ -345,7 +377,9 @@ function editUpdate() tileTable[7+ind]:draw(373,181) tileTable[8+ind]:draw(373,209) elseif editor == "pos2Saw" then - gfx.drawText("SELECT TARGET POSITION \nTRAVEL TIME: "..traveltime,0,0) + gfx.drawText("SELECT TARGET POSITION \nTRAVEL TIME: "..traveltime.."S",0,0) + elseif editor == "pos2Spin" then + gfx.drawText("< "..armamount.." > ARMS\nV "..armlength.." ^ BLADES PER ARM\nROTATION SPEED: "..traveltime,0,0) elseif editor == "main" then imgMus:draw(366, 176) imgAdd:draw(366,8) diff --git a/Source/Map.lua b/Source/Map.lua index b25cd95..fb7b9d2 100644 --- a/Source/Map.lua +++ b/Source/Map.lua @@ -50,6 +50,7 @@ function addMap(_file, rs) addPlayer(level.rocket.x+14,level.rocket.y+15, level.bigrocket.x+32, level.bigrocket.y+32) tiles = gfx.sprite.addWallSprites(tilemap, {0,1,7,8,9,10,11,12,13,14,15,16}) + print(tilemap:getTileAtPosition(1,10)) sprTiles:remove() sprTiles = gfx.sprite.new(tilemap) diff --git a/Source/Saws.lua b/Source/Saws.lua index 6d1f783..78f4b8b 100644 --- a/Source/Saws.lua +++ b/Source/Saws.lua @@ -122,6 +122,7 @@ function updateSaws() spinblades[spinner].time += spinblades[spinner].speed local degrees = (360 / #spinblades[spinner].arms * arm + spinblades[spinner].time) + if degrees % 360 == 0 then spinblades[spinner].time = 0 end local position = {x=math.sin(math.rad(degrees)) * 20 * blade,y=math.cos(math.rad(degrees)) * 20 * blade} spinblades[spinner].arms[arm][blade]:setImage(loopSaws:image()) diff --git a/Source/launcher/card-pressed.png b/Source/launcher/card-pressed.png new file mode 100644 index 0000000000000000000000000000000000000000..69bf407e42e1e4e3e46e3bacaba01257ac062f0b GIT binary patch literal 1591 zcmaJ?e>{_U9Di_A8LwQw{K|BhACXi_U5+}D4dI08hw-8=FU#+=#f)>8Zs*6c-O^7~ zI%%3y7}=v@+O6Xft>wqCjmWh1aEvCq=h6T7&+~o0@7MeL{(L^~_v?AS^pGGw6C+C_ z002zzIG<1e&?Ca{*H;?CPp9)U)c}B6!uxz5M!E4p`YKJ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