Multi-layer 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
kirkdev
Prole
Posts: 1
Joined: Fri Jun 21, 2019 5:17 pm

Multi-layer Background

Post by kirkdev » Fri Jun 21, 2019 5:37 pm

Hello,

My name is Kirk. I have just started playing around with Love2D, maybe for 2 weeks or so now. I was impressed at how quick I was able to put something together and completed a small shooting gallery game in a single evening.
The attachment ShootingGallery.png is no longer available
(Crosshair attached to mouse hidden in screenshot for some reason)

I am now going to complete a slightly bigger project in which it has multiple images used as the background to create a parallax effect. I seem to be having problems of the bat just loading these images. I have attached the 2 of the 4 layers I am using for the background 1-4 in which the order they should be drawn.

I am getting a black background and no errors. After further investigation it looks like image 1 loads and can be drawn just fine but the other 3 do not load at all.

Is there some issue with loading images which have alpha?
Attachments
ShootingGallery.png
ShootingGallery.png (293.68 KiB) Viewed 3406 times

Xugro
Citizen
Posts: 60
Joined: Wed Sep 29, 2010 8:14 pm

Re: Multi-layer Background

Post by Xugro » Sat Jun 22, 2019 2:57 pm

There is no problem with loading and drawing images that have alpha transparency. Just use the normal image loading function love.graphics.newImage(filename). You can take a peek at my example if you like (big thanks to PWL for the images).
Attachments
parallax_background.love
Example of parallax background.
(245.37 KiB) Downloaded 101 times

User avatar
zorg
Party member
Posts: 2704
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Multi-layer Background

Post by zorg » Sat Jun 22, 2019 3:07 pm

If the images are too big, you might be running out of texture memory; sadly, without you sharing all the necessary information (code and assets, but preferably as a .love file of a minimal example where it still happens), the only thing we can do is just guess.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.

Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests