Asset(s) Located In Subfolders

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
User avatar
Posts: 28
Joined: Sat Nov 29, 2014 12:13 am

Asset(s) Located In Subfolders

Post by i_love_u » Thu Mar 12, 2015 5:20 am

I would like to organize my art assets for my game. But, I realized that they will not be found if I put them within a subfolder located in the folder containing my main.lua. For example, if I create a folder for my art assets, then put one of my sprites in there and run the following line:

Then, it will display the error:
Could not open file sprite.png. Does not exist.

Is there a way for me to have my assets in subfolders so that my game-related files are not so cluttered and unorganized?

User avatar
Party member
Posts: 248
Joined: Mon Oct 20, 2014 3:26 pm

Re: Asset(s) Located In Subfolders

Post by arampl » Thu Mar 12, 2015 5:29 am

Sure. For example:

sprite ="sprites/sprite.png")
background ="backgrounds/something.png")

It is not only a matter of better organizing. Imagine you have two files with the same name...

Post Reply

Who is online

Users browsing this forum: No registered users and 37 guests