Hello all!
I'm new to Love2D and I'm already making great progress, but I am stuck trying to implement a horizontal scrolling background.
What is the best way to do this?
Thanks in advance!
Ben
Scrolling horizontal background
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- CanadianGamer
- Party member
- Posts: 132
- Joined: Tue Jun 30, 2015 1:23 pm
- Location: Canada
- Contact:
Re: Scrolling horizontal background
Welcome to the forums.
All you need to do is change the x coordinate of where the background is being drawn.
For example if you are currently drawing the background at 0, 0 try drawing it at progressively
smaller or larger x coordinates to make it 'move'.
All you need to do is change the x coordinate of where the background is being drawn.
For example if you are currently drawing the background at 0, 0 try drawing it at progressively
smaller or larger x coordinates to make it 'move'.
My serious itch.io page:
https://pentamonium-studios.itch.io/
My less serious itch.io page:
http://canadiangamer.itch.io
https://pentamonium-studios.itch.io/
My less serious itch.io page:
http://canadiangamer.itch.io
-
- Citizen
- Posts: 87
- Joined: Tue Dec 30, 2014 6:07 pm
Re: Scrolling horizontal background
You've got two options. Either you have a fixed camera and move everything each frame to move around the viewpoint or you have fixed things on the screen and move the screen/camera around to move the view.
While the former method may be a little easier than if you opt for moving the screen instead then when you change the x and y coords of something you really know it moved from its prior position relative to the viewpoint.
There's libraries for the moving camera such as hump.camera or you can use the Love2d features with love.graphics.translate and do it yourself.
While the former method may be a little easier than if you opt for moving the screen instead then when you change the x and y coords of something you really know it moved from its prior position relative to the viewpoint.
There's libraries for the moving camera such as hump.camera or you can use the Love2d features with love.graphics.translate and do it yourself.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 1 guest