Page 1 of 1

Help with using/loading an image

Posted: Sun Jun 26, 2016 7:34 pm
by skiippii
Hi, I am a new LOVE user and I've been sat around for the past hour trying to figure out how to set the directory at which my main.lua will find a file on my computer.

Code: Select all

local imageFile

function love.load()
	imageFile = love.graphics.newImage("wom.png")
	
end
function love.draw()
    love.graphics.draw(imageFile)
end
^ is my current code, however when I run thisI get error " main.lua:10: Could not open file wom.png. Does not exist."
I have seen people before say that the image needs to be in the same directory as the main.lua file
https://love2d.org/imgmirrur/JwncWtP.png

I don't understand why the image won't load up, any tips?

Re: Help with using/loading an image

Posted: Sun Jun 26, 2016 11:44 pm
by pgimeno
What is line 10 in your file? The snippet you've pasted has 9 lines.

Re: Help with using/loading an image

Posted: Sun Jun 26, 2016 11:51 pm
by Nixola
The image is called "wom.png.png". Thank Windows for hiding files extensions, letting people into this kind of mistakes and into scams. Rename the file to "wom" and you should be fine, but I'd suggest you to search how to see files extensions.

Re: Help with using/loading an image

Posted: Mon Jun 27, 2016 1:34 am
by s-ol
Nixola wrote:The image is called "wom.png.png". Thank Windows for hiding files extensions, letting people into this kind of mistakes and into scams. Rename the file to "wom" and you should be fine, but I'd suggest you to search how to see files extensions.
folder options > uncheck "hide known extensions". That and "hide system files" are the first two things I do on ANY windows system I get my hands on.

Re: Help with using/loading an image

Posted: Mon Jun 27, 2016 5:47 am
by zorg
skiippii wrote:Hi, I am a new LOVE user and I've been sat around for the past hour trying to figure out how to set the directory at which my main.lua will find a file on my computer.
Just to clarify, you can't really do that though; you have two "root" folders, the project folder, where your main.lua is, and the save folder where you can create/modify files and folders. The former can be anywhere, the latter has specific locations depending on operating system and whether the game is fused or not.

That said, what the others said above should fix your issue.

s-ol wrote:
Nixola wrote:The image is called "wom.png.png". Thank Windows for hiding files extensions, letting people into this kind of mistakes and into scams. Rename the file to "wom" and you should be fine, but I'd suggest you to search how to see files extensions.
folder options > uncheck "hide known extensions". That and "hide system files" are the first two things I do on ANY windows system I get my hands on.
I go a few steps further and disable UAC, then do a forced takeown(ership) of the root drive and all files so that i can freely delete stuff that i know i don't want running; poweruser :3[/size]

Re: Help with using/loading an image

Posted: Mon Jun 27, 2016 8:11 am
by Nixola
I go one step further and don't use it but I'm getting off topic now.