Long time lurker first time poster, currently enjoying love, but having little bits of teething problems. Essentially what I would like to do seems simple enough but for some reason I can't get my head around it.
essentially I would like to be to have a block that starts from one point, scrolls to the next, and when it does reach that point it scrolls back to the original point and repeats, etc,.
This is an example of what I think it should be..
Code: Select all
function love.load()
thing = {}
thing.x = 30
thing.y = 30
thing.width = 40
thing.height = 40
thing.speed = 100
End
function love.update(dt)
If thing.x < 20 then
thing.x = thing.x + thing.speed * dt
end
If thing.x > 200 then
thing.x = thing.x - thing.speed * dt
end
function love.draw()
Love.graphics.setColor(255,255,255)
Love.graphics.rectangle("fill", thing.x,thing.y,thing.width,thing.height)
End