diff --git a/main.lua b/main.lua index 8ac8e0d..cd2486c 100644 --- a/main.lua +++ b/main.lua @@ -39,20 +39,6 @@ local side = { local velocity = {0, 0} local current = { } -local tempAttached = nil - -function mirrorCollider(collider, side) - current.x, current.y = collider:getPosition() - if side == 'LEFT' then - current.x = current.x - CONST_SIDES.LEFT[1] - current.x = CONST_SIDES.RIGHT[1] + CONST_SIDES.WIDTH - current.x - else - current.x = current.x - CONST_SIDES.RIGHT[1] - current.x = CONST_SIDES.LEFT[1] + CONST_SIDES.WIDTH - current.x - end - collider:setPosition(current.x, current.y) -end - function love.load() love.window.setMode(512, 512) @@ -89,11 +75,6 @@ function love.update(dt) world:update(dt) crates:update(dt) - --[[ if input:down('moveUp') then magnet.collider:applyLinearImpulse(0, -player.maxSpeed.y) end - if input:down('moveLeft') then magnet.collider:applyLinearImpulse(-player.maxSpeed.x, 0) end - if input:down('moveRight') then magnet.collider:applyLinearImpulse(player.maxSpeed.x, 0) end - if input:down('moveDown') then magnet.collider:applyLinearImpulse(0, player.maxSpeed.y) end ]]-- - -- this is temp, ofc, it's ugly af if input:pressed('switch') then velocity = {0, 0} @@ -127,17 +108,17 @@ function love.update(dt) end function love.draw() - --[[love.graphics.clear(255, 255, 255) - - love.graphics.setColor(0, 0, 0, 1) - love.graphics.polygon('line', CONST_SIDES.LEFT) - love.graphics.rectangle('line', magnet.x, magnet.y, 32, 32) ]]-- - world:draw() - - current.x, current.y = magnet.collider:getPosition() - love.graphics.print('Pos X: ' .. current.x .. ', Pos Y: ' .. current.y) - - -- love.graphics.print('Key code: ' .. key) - --love.graphics.draw(assets.sprites.crane) +end + +function mirrorCollider(collider, side) + current.x, current.y = collider:getPosition() + if side == 'LEFT' then + current.x = current.x - CONST_SIDES.LEFT[1] + current.x = CONST_SIDES.RIGHT[1] + CONST_SIDES.WIDTH - current.x + else + current.x = current.x - CONST_SIDES.RIGHT[1] + current.x = CONST_SIDES.LEFT[1] + CONST_SIDES.WIDTH - current.x + end + collider:setPosition(current.x, current.y) end