added a timer for cleaner execution, goodbye resolver!

This commit is contained in:
2021-05-08 18:13:33 +02:00
parent b103140ea1
commit 55f0d2f0da
3 changed files with 268 additions and 15 deletions

View File

@@ -59,6 +59,7 @@ function love.load()
input:bind(love.keyboard.getKeyFromScancode('d'), 'moveRight')
input:bind(love.keyboard.getKeyFromScancode('s'), 'moveDown')
input:bind(love.keyboard.getKeyFromScancode('space'), 'switch')
input:bind(love.keyboard.getKeyFromScancode('lshift'), 'detach')
crates:init(world, magnet)
crates:spawn(120, 400)
@@ -91,6 +92,13 @@ function love.update(dt)
else
magnet.side = 'LEFT'
end
elseif input:pressed('detach') then
velocity = {0, 0}
local attached = crates:getAttached()
for key in pairs(attached) do
crates:detach(key)
end
else
if input:down('moveUp') or input:down('moveLeft') or input:down('moveRight') or input:down('moveDown') then
if input:down('moveUp') then velocity[2] = -player.maxSpeed.y