Hi everyone!
This is my first post as a member. Please inform me if I break any rules. (Just in case...)
How could I make a background scroll to the right continuously, with the same image repeating over and over. I also want the movement to start automatically when the game runs.
I am not creating a game right now, but I just want to know how to do this for future reference.
Here is my code. (Not so much code because I am just focusing on the background)
function love.load()
bg = love.graphics.newImage("background.png")
end
function love.update(dt)
end
function love.draw()
love.graphics.setColor(255,255,255,255)
love.graphics.draw(bg)
end
I made this demo by cutting an image in two and resetting the position everytime one of them reach the end.
I know there might be a better solution, but this is what i could think of
There are many ways to do it, but having 2 background images scrolling is the simplest way. The code may look like this (assuming that the background image is the same size as the window, and that you are changing the X coordinate only):
Mighty Tuna wrote:Hi everyone!
This is my first post as a member. Please inform me if I break any rules. (Just in case...)
I inform you that you broke a basic rule on your first post: search the forums before posting a question, because just 10 threads below this, you can find this:
Mighty Tuna wrote:Hi everyone!
This is my first post as a member. Please inform me if I break any rules. (Just in case...)
I inform you that you broke a basic rule on your first post: search the forums before posting a question, because just 10 threads below this, you can find this:
Mighty Tuna wrote:Hi everyone!
This is my first post as a member. Please inform me if I break any rules. (Just in case...)
I inform you that you broke a basic rule on your first post: search the forums before posting a question, because just 10 threads below this, you can find this: