whag
This commit is contained in:
parent
da60050e90
commit
a869b1cf95
2 changed files with 43 additions and 11 deletions
|
@ -34,7 +34,7 @@ function addMap(_file, rs)
|
|||
tilemap:setTileAtPosition(level.tiles[i].x,level.tiles[i].y,level.tiles[i].t)
|
||||
end
|
||||
|
||||
tiles = gfx.sprite.addWallSprites(tilemap, {0,1,7,8,9,10,11,12,13,14,15,16})
|
||||
--tiles = gfx.sprite.addWallSprites(tilemap, {0,1,7,8,9,10,11,12,13,14,15,16})
|
||||
|
||||
song:stop()
|
||||
if level.song then
|
||||
|
|
|
@ -47,18 +47,33 @@ function loadSpins(_spins)
|
|||
local s = _spins[i]
|
||||
s.x+= 8
|
||||
s.y+= 8
|
||||
if s.middle then
|
||||
|
||||
s.middle = gfx.sprite.new(loopSaws:image())
|
||||
s.middle:setCollideRect(0,0,16,16)
|
||||
else
|
||||
s.middle = gfx.sprite.new(imgTarget)
|
||||
end
|
||||
|
||||
s.middle:moveTo(s.x,s.y)
|
||||
s.middle:setZIndex(1)
|
||||
s.middle:add()
|
||||
|
||||
local sb = {speed=s.speed,arms={},mid=s.middle,time=0}
|
||||
for i = 1, s.arms, 1 do
|
||||
local sb = {speed=s.speed,arms=s.arms,armlen=s.armlen,saws = {},arcs = {},time=0}
|
||||
|
||||
for len = 1, s.armlen, 1 do
|
||||
local arc = playdate.geometry.arc.new(s.x,s.y, 20 * len, 0, 360)
|
||||
|
||||
for arm = 1, s.arms, 1 do
|
||||
local saw = gfx.sprite.new(loopSaws:image())
|
||||
local sawPos = arc:pointOnArc(arc:length() / s.arms * arm)
|
||||
|
||||
saw:moveTo(sawPos.x,sawPos.y)
|
||||
saw:add()
|
||||
|
||||
sb.saws[#sb.saws+1] = saw
|
||||
end
|
||||
|
||||
sb.arcs[#sb.arcs+1] = arc
|
||||
end
|
||||
|
||||
--[[for i = 1, s.arms, 1 do
|
||||
sb.arms[i] = {}
|
||||
for p = 1, s.armlen, 1 do
|
||||
local degrees = (360 / s.arms) * i
|
||||
|
@ -70,7 +85,7 @@ function loadSpins(_spins)
|
|||
sb.arms[i][p]:setZIndex(1)
|
||||
sb.arms[i][p]:add()
|
||||
end
|
||||
end
|
||||
end]]
|
||||
spinblades[#spinblades+1] = sb
|
||||
end
|
||||
end
|
||||
|
@ -123,7 +138,24 @@ function updateSaws()
|
|||
end
|
||||
end
|
||||
|
||||
--{speed=s.speed,arms=s.arms,armlen=s.armlen,saws = {},arcs = {},time=0}
|
||||
for spinner = 1, #spinblades, 1 do
|
||||
local s = spinblades[spinner]
|
||||
|
||||
s.time += s.speed
|
||||
print(s.time)
|
||||
|
||||
for len = 1, s.armlen, 1 do
|
||||
local arc = s.arcs[len]
|
||||
|
||||
for arm = 1, s.arms, 1 do
|
||||
local sawPos = arc:pointOnArc(arc:length() / s.arms * arm + s.time)
|
||||
|
||||
s.saws[arm]:moveTo(sawPos.x,sawPos.y)
|
||||
end
|
||||
end
|
||||
end
|
||||
--[[for spinner = 1, #spinblades, 1 do
|
||||
for arm = 1, #spinblades[spinner].arms do
|
||||
for blade = 1, #spinblades[spinner].arms[arm] do
|
||||
|
||||
|
@ -137,7 +169,7 @@ function updateSaws()
|
|||
spinblades[spinner].arms[arm][blade]:moveTo(spinblades[spinner].mid.x + position.x, spinblades[spinner].mid.y + position.y)
|
||||
end
|
||||
end
|
||||
end
|
||||
end]]
|
||||
end
|
||||
|
||||
function killBlades()
|
||||
|
|
Loading…
Reference in a new issue