What does it means? Btw here is the code:
Code: Select all
function game_load()
rectangle = {
{x = 0, y = 0, w = 128, h = 128},
{x = 400, y = 300, w = 128, h = 128}
}
end
function game_update(dt)
player_update(dt)
if player.x > love.graphics.getWidth() / 2 then
camera.x = player.x - love.graphics.getWidth() / 2
end
if player.y > love.graphics.getWidth() / 2 then
camera.y = player.y - love.graphics.getWidth() / 2
end
end
function game_draw()
camera:set()
if CheckCollision(player.x, player.y, player.w, player.h, rectangle[2].x, rectangle[2].y, rectangle[2].w, rectangle[2].h) then
love.graphics.setColor(255,0,0)
else
love.graphics.setColor(255,255,255)
end
for i=1, #rectangle do
love.graphics.rectangle("fill",rect[i].x,rectangle[i].y,rectangle[i].w,rectangle[i].h)
end
love.graphics.print("FPS: ".. love.timer.getFPS(),camera.x+16,camera.y+16)
player_draw()
camera:unset()
end
function CheckCollision(x1, y1, w1, h1, x2, y2, w2, h2)
if x1 > (x2 + w2) or (x1 + w1) < x2 then return false end
if y1 > (y2 + h2) or (y1 + h1) < y2 then return false end
return true
end