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 0000000..69bf407 Binary files /dev/null and b/Source/launcher/card-pressed.png differ