added a timer for cleaner execution, goodbye resolver!
This commit is contained in:
8
main.lua
8
main.lua
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user