Page 1 of 1

Help with loading an image on to screen

Posted: Wed Mar 04, 2015 4:41 pm
by Jamax91x
Hello, I am currently having an issue with loading a png image on to my programme.

The error message is:

main.lua:65: Incorrect parameter type: expected userdata.

Traceback

[C]: in function 'draw'
main.lua: in function 'draw'
[C]: in function 'xpcall'

Any help with this error would be great :)

I can post the code also, but I have attached the file in question on this post.

Thanks

Re: Help with loading an image on to screen

Posted: Wed Mar 04, 2015 5:55 pm
by s-ol
love.graphics.draw expects an Image as an argument, not a string that is the name of some image. You are passing in "barrel" instead of barrel.s (whose definion you need to uncomment again in line 29).

Re: Help with loading an image on to screen

Posted: Thu Mar 05, 2015 9:36 am
by Sosolol261
You forgot to add a image. You would need something like this:

Code: Select all

--under barrel = []
--i stands for image
barrel.i = love.graphics.newImage(theLocationOfTheImage)
theLocationOfTheImage would be something like

Code: Select all

'textures/images/entities/barrel.png'
You got it?