[Solved] Love2d programming question
Posted: Tue Sep 27, 2016 3:07 pm
Hello Guys,
im programming a little game and I have a problem. My problem is that the rectangle doesnt go out of the little gap . He can move within the zone. But i want him to move out of the little gap in the right upper corner. How can i do that? Help and suggestions are appreciated.
Thank you
im programming a little game and I have a problem. My problem is that the rectangle doesnt go out of the little gap . He can move within the zone. But i want him to move out of the little gap in the right upper corner. How can i do that? Help and suggestions are appreciated.
Thank you
Code: Select all
function love.load()
quadX = 30
quadY = 540
end
function zeichneQuad(x,y,b,h)
love.graphics.rectangle("fill",x,y,b,h)
end
function love.draw()
love.graphics.line(5,5,725,5)
love.graphics.line(5,5,5,595)
love.graphics.line(5,595,795,595)
love.graphics.line(795,5,795,595)
zeichneQuad(quadX,quadY,30,30)
end
function love.keypressed(key)
if key == "up" and quadY +30 > 35 then
quadY = quadY -5
end
if key == "down" and quadY + 5 < 570 then
quadY = quadY + 5
end
if key == "right" and quadX +5 < 770 then
quadX = quadX + 5
end
if key == "left" and quadX +30 > 35 then
quadX = quadX - 5
end
end