How I do a moving background?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
jajasuperman
Prole
Posts: 16
Joined: Wed Feb 20, 2013 7:16 pm

How I do a moving background?

Post by jajasuperman »

Hi all!
I am going to do a mario game.
In mario games, mario is in the middle of the screen, and when you walk, the screen move and when you reach the end, you can get to the bottom of the screen.

How I do this?

Goodbye.

PD: Sorry with my bad english, is not my language :S
User avatar
Ragzouken
Citizen
Posts: 84
Joined: Fri Aug 10, 2012 7:59 am
Contact:

Re: How I do a moving background?

Post by Ragzouken »

I think the Gamera library (viewtopic.php?f=5&t=12033) will do what you want most easily.
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

Re: How I do a moving background?

Post by T-Bone »

If you want the background to scroll at the same speed as the foreground, just using love.graphics.translate should do the trick. If you want some parallax effect, it's a little bit more tricky but not really hard.

If you know how to draw the background to the screen, you can just draw it a little bit to the left every frame, that's a good start. Then make sure you only move it to the left when the player is moving.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 61 guests