huh, it made sense to me and I guess that it would still be nil if I exchanged red with the number 1?artofwork wrote: love.graphics.setColor() doesn't return a value so your local variable Red would be nil.
I appreciate the thought but it's not what I'm currently looking for, I'm still into the idea of having the colours accessed by the numbers on the keyboard.Zilarrezko wrote:If you wanted to pick a color with your mouse.Code: Select all
Screenshot = love.graphics.newScreenshot(true) --Takes a screen shot, and returns an image data. The parameter is a boolean "Copy Alpha" local r, g, b, a = Screenshot:getPixel(mouseX - 1, mouseY - 1) --image data is 0 based, so we minus 1 as Lua and love2d is 1 based. --Use r, g, b, a however you want. (Not sure what it will do if you don't copy the alpha though. I didn't test it.) --After storing the variable or something... Delete the image object, or just make it local so it will delete itself after a function ends.