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 »

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 5433 times
Xugro
Party member
Posts: 110
Joined: Wed Sep 29, 2010 8:14 pm

Re: Multi-layer Background

Post by Xugro »

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 242 times
User avatar
zorg
Party member
Posts: 3441
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Multi-layer Background

Post by zorg »

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: Ahrefs [Bot], Bing [Bot] and 139 guests