Love2D can't find my files

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
Afrricyn
Prole
Posts: 11
Joined: Fri Feb 21, 2020 4:17 pm

Love2D can't find my files

Post by Afrricyn »

When I tried to make a font within my game it said that it could open my Font file even though it was in the correct place and even with audio files it can't seem to find my audio file as well.

https://stackoverflow.com/questions/60 ... font-file

This is the Audio code, I have also tried changing the path to sounds/name.wav - as the file sounds is with the main.lua file

Code: Select all

    sounds = {
        ["PongSE"] = love.audio.newSource("D:/VS - LUA/pong/sounds/PongSE.wav", "static"),
        ["win"] = love.audio.newSource("D:/VS - LUA/pong/sounds/win.wav","static"),
        ["wallhit"] = love.audio.newSource("D:/VS - LUA/pong/sounds/wallhit.wav", "static")
    }
This is my file directory
This is my file directory
love2d.png (321.97 KiB) Viewed 4617 times
Optikon
Prole
Posts: 12
Joined: Mon Mar 30, 2020 6:21 pm

Re: Love2D can't find my files

Post by Optikon »

So you tried this and it didn't work?:

Code: Select all

sounds = {
        ["PongSE"] = love.audio.newSource("sounds/PongSE.wav", "static"),
        ["win"] = love.audio.newSource("sounds/win.wav","static"),
        ["wallhit"] = love.audio.newSource("sounds/wallhit.wav", "static")
    }
Could you post a screenshot of the error, please?
Optikon Level Designer - A simple and intuitive WYSIWYG visual level designer for LÖVE that does all the basic Lua coding for you
User avatar
pgimeno
Party member
Posts: 3673
Joined: Sun Oct 18, 2015 2:58 pm

Re: Love2D can't find my files

Post by pgimeno »

Is it possible that you're running main.love instead of main.lua, and that main.love does not have the files? What happens if you remove main.love and run Löve passing the folder as argument?
Afrricyn
Prole
Posts: 11
Joined: Fri Feb 21, 2020 4:17 pm

Re: Love2D can't find my files

Post by Afrricyn »

Yes, That's most likely the issue. How do I run Love and pass the folder as an argument?
User avatar
zorg
Party member
Posts: 3468
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Love2D can't find my files

Post by zorg »

Afrricyn wrote: Thu Apr 16, 2020 1:03 pm Yes, That's most likely the issue. How do I run Love and pass the folder as an argument?
https://love2d.org/wiki/Getting_Started#Windows

Alternatively, the way i like to do it: put the bold line, including quote marks, below, into an empty text file using notepad or your code editor of choice, change the paths to point to where your love.exe (or lovec.exe if you always want to have a command line open) is, and to where your project's folder/directory is. Not main.lua, the directory it is in.

"C:\Program Files\LOVE\love.exe" "C:\games\mygame"

save it as whatever, but i personally prefer to call it "mygame.bat" or just simply "run.bat"

doubleclicking that should work, no matter where that file is.
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.
Afrricyn
Prole
Posts: 11
Joined: Fri Feb 21, 2020 4:17 pm

Re: Love2D can't find my files

Post by Afrricyn »

Ye, Thanks all. Managed to fix the issue.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 0 guests