cleaned a bit again
This commit is contained in:
43
main.lua
43
main.lua
@@ -39,20 +39,6 @@ local side = {
|
|||||||
local velocity = {0, 0}
|
local velocity = {0, 0}
|
||||||
local current = { }
|
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()
|
function love.load()
|
||||||
love.window.setMode(512, 512)
|
love.window.setMode(512, 512)
|
||||||
|
|
||||||
@@ -89,11 +75,6 @@ function love.update(dt)
|
|||||||
world:update(dt)
|
world:update(dt)
|
||||||
crates: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
|
-- this is temp, ofc, it's ugly af
|
||||||
if input:pressed('switch') then
|
if input:pressed('switch') then
|
||||||
velocity = {0, 0}
|
velocity = {0, 0}
|
||||||
@@ -127,17 +108,17 @@ function love.update(dt)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function love.draw()
|
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()
|
world:draw()
|
||||||
|
end
|
||||||
current.x, current.y = magnet.collider:getPosition()
|
|
||||||
love.graphics.print('Pos X: ' .. current.x .. ', Pos Y: ' .. current.y)
|
function mirrorCollider(collider, side)
|
||||||
|
current.x, current.y = collider:getPosition()
|
||||||
-- love.graphics.print('Key code: ' .. key)
|
if side == 'LEFT' then
|
||||||
--love.graphics.draw(assets.sprites.crane)
|
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
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user