Screen detection help!
Posted: Sun Dec 22, 2013 6:11 am
Hello, I'm new to the Love2d engine and i'm trying to make my object stay inside the window. my script is only acting as if it doesn't detect the bottom edge of the window and the object goes underneath it.. here is my code:
Code: Select all
function map_collisions()
if player.x < 0 then
player.x = 0
end
if player.y < 0 then
player.y = 0
end
if player.y + player.graphic:getHeight() > 700 then
player.y = 700 - player.graphic:getHeight()
end
if player.x + player.graphic:getWidth() > 800 then
player.x = 0
end
end