Code: Select all
x = 350
y = 250
function love.load()
love.graphics.setBackgroundColor( 255, 255, 255, 255)
end
function love.draw()
love.graphics.setColor( 0, 0, 0, 255 )
love.graphics.rectangle( "fill", x, y, 100, 100)
end
function love.update(dt)
if love.keyboard.isDown("right") then
x = x + 128*dt
end
if love.keyboard.isDown("left") then
x = x - 128*dt
end
if love.keyboard.isDown("up") then
y = y - 128*dt
end
if love.keyboard.isDown("down") then
y = y + 128*dt
end
if x > 800 then
x = -100
end
if y > 600 then
y = -100
end
if x = -100 then
x = 900
end
if y = -100 then
y = 700
end
end