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

Asset(s) Located In Subfolders

Post by i_love_u »

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:
sprite= love.graphics.newImage("sprite.png"),

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
arampl
Party member
Posts: 248
Joined: Mon Oct 20, 2014 3:26 pm

Re: Asset(s) Located In Subfolders

Post by arampl »

Sure. For example:

sprite = love.graphics.newImage("sprites/sprite.png")
background = love.graphics.newImage("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: Bing [Bot] and 79 guests