Code: Select all
local BlockTable = {
Block1 = {
x = 181,width = 409,y = 220,height = 220},
Block2 = {
x = 9999,width = 9999,y = 462,height = 462},
Block3 = {
x = 9999,width = 9999,y = 9999,height = 9999},
Block4 = {
x = 9999,width = 9999,y = 9999,height = 9999}
}
f
Code: Select all
function love.update(dt)
move_up_down(dt)
end
Code: Select all
function move_up_down(dt)
if love.keyboard.isDown("w") then
for i, block in ipairs(BlockTable) do
for h=1, block.Block[i] do
if player.x > BlockTable[i].Block[h].x and player.x < BlockTable[i].Block[h].height and player.y > BlockTable[i].Block[h].y or player.y > ObjectTable[1] then
player.y = player.y - 100 * dt
else
player.y = player.y - 0 * dt
end end end end end