Re: Image issues
Posted: Sat Oct 07, 2017 2:27 pm
Yes, people know how to fix this. Read a tutorial.
Misc.resolveFile accepts a filename as a string and returns a filepath as a string.TheKidCodee wrote:I was already reading the PGE wiki before you said that. And i still am. Now please let me figure out how to layout LuaImageResource.PixelPest wrote:I know I said that I wouldn't help you again unless you read a tutorial, but I will say one more thing: you're still making the same mistakes over and over again; you've done this same thing at least five times and still haven't listened to what people have told you. If you don't read a tutorial you're going to hit a point where you're unable to get any more help from people directly as you're going to have pissed off everyone who has the potential to help you. You're pretty close to that point
LuaImageResource is, as far as you should be concerned, a type, just like boolean/number/table/function. Technically it's userdata, or in B4 a table, but for your purposes just think of it as a type of its own.TheKidCodee wrote:Ok. But whats a LuaImageResource? now i know its not a filepathThe0x539 wrote:Misc.resolveFile accepts a filename as a string and returns a filepath as a string.TheKidCodee wrote: I was already reading the PGE wiki before you said that. And i still am. Now please let me figure out how to layout LuaImageResource.
Graphics.loadImage accepts a filepath as a string and returns a LuaImageResource.
Graphics.drawImage accepts a LuaImageResource and coordinates and draws the image at that location.
TheKidCodee wrote:The0x539 wrote:LuaImageResource is, as far as you should be concerned, a type, just like boolean/number/table/function. Technically it's userdata, or in B4 a table, but for your purposes just think of it as a type of its own.TheKidCodee wrote: Ok. But whats a LuaImageResource? now i know its not a filepathCode: Select all
function onInputUpdate() Graphics.loadImage("Hudpics\\score.png") end
Code: Select all
function onNPCKill()
8 + 3
end
HUDpics/score should be enclosed in quotes and have a file extension. Right now it's interpreting HUDpics as a variable and score as a variable, and trying to divide HUDpics by score. With quotes, it'll be interpreted as the string of text that you mean for it to be.TheKidCodee wrote:I dont rememeber it that much so chances are some of the mistakes i made here might not in my actual code. I cant go and check right nowCode: Select all
local Hudscore = Graphics.loadImage(Misc.resolveFile(HUDpics/score))
You're missing one thing (you started something but never ended itTheKidCodee wrote:I was back hours ago but i didnt come to the fourms. This is what it actually looks like.The0x539 wrote:HUDpics/score should be enclosed in quotes and have a file extension. Right now it's interpreting HUDpics as a variable and score as a variable, and trying to divide HUDpics by score. With quotes, it'll be interpreted as the string of text that you mean for it to be.TheKidCodee wrote:I dont rememeber it that much so chances are some of the mistakes i made here might not in my actual code. I cant go and check right nowCode: Select all
local Hudscore = Graphics.loadImage(Misc.resolveFile(HUDpics/score))
That aside, this is some of the most correct LunaLua code you've ever written.you think you post something but you actually didnt godamnitCode: Select all
local hudscore = Graphics.loadImage(Misc.resolvefile("HUDpics/score.png))
This is valid, correct, and good practice, assuming the file exists. hudscore is now a variable ready to be fed into a function from the Graphics.draw family.TheKidCodee wrote:The0x539 wrote:You're missing one thing (you started something but never ended itTheKidCodee wrote: I was back hours ago but i didnt come to the fourms. This is what it actually looks like.you think you post something but you actually didnt godamnitCode: Select all
local hudscore = Graphics.loadImage(Misc.resolvefile("HUDpics/score.png))
*Again What it Actually looks like.Code: Select all
local hudscore = Graphics.loadImage(Misc.resolvefile("HUDpics/score.png"))
It will show if you draw it in one of the main event loop callbacks.TheKidCodee wrote:Will it show?The0x539 wrote:This is valid, correct, and good practice, assuming the file exists. hudscore is now a variable ready to be fed into a function from the Graphics.draw family.TheKidCodee wrote:*Again What it Actually looks like.Code: Select all
local hudscore = Graphics.loadImage(Misc.resolvefile("HUDpics/score.png"))
Sorry for what?TheKidCodee wrote:im sorry?The0x539 wrote:It will show if you draw it in one of the main event loop callbacks.TheKidCodee wrote: Will it show?
No, check your capitalization. As for whether you should use the function you're trying to say, it depends on whether the coordinates you're drawing at are a position in the world or a position on the screen.TheKidCodee wrote:For not understanding BUT! Its drawImagetoScene right?Kley wrote:TheKidCodee wrote: im sorry?
Then anything with the word "scene" in it is the wrong function.TheKidCodee wrote:On screenThe0x539 wrote:No, check your capitalization. As for whether you should use the function you're trying to say, it depends on whether the coordinates you're drawing at are a position in the world or a position on the screen.TheKidCodee wrote: For not understanding BUT! Its drawImagetoScene right?