General discussion about LÖVE, Lua, game development, puns, and unicorns.
Neverfly
Prole
Posts: 10 Joined: Sat Jun 06, 2009 5:39 pm
Post
by Neverfly » Sat Jun 06, 2009 7:52 pm
Say I did this:
Code: Select all
function load()
image = love.graphics.newImage("Images/uziah.png")
end
function draw()
love.graphics.draw(image, 200,200)
end
Now, when I did image = love.graphics.newImage("Images/uziah.png"), I got the error:
could not load file Images/uziah.png
Now my question is, Where does the system look for an image. I typed in the full directory once, and It still didn't work.
BTW, Images is a folder which resides in C: Program Files/ LOVE
rude
Administrator
Posts: 1052 Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway
Post
by rude » Sat Jun 06, 2009 8:12 pm
LÖVE uses a virtual filesystem which mounts the directory of the running game. See
love.filesystem .
Code: Select all
Correct directory structure:
c:\lol\awesome\game\main.lua
c:\lol\awesome\game\Images\uziah.png
Then run:
love c:\lol\awesome\game
Neverfly
Prole
Posts: 10 Joined: Sat Jun 06, 2009 5:39 pm
Post
by Neverfly » Sat Jun 06, 2009 9:31 pm
Ok, so what would be the final code?
I really didn't get that example.
rude
Administrator
Posts: 1052 Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway
Post
by rude » Sat Jun 06, 2009 10:14 pm
The final code would be your initial code; there's nothing wrong with it. LÖVE mounts the directory containing main.lua as its virtual file system root.
Also,
WTFM .
(W = watch)
Users browsing this forum: Semrush [Bot] and 2 guests