Page 1 of 1

Help with loading an image

Posted: Wed May 19, 2021 6:02 pm
by LunarCatUSA
So I want to display a 256 by 256 PNG image on the screen during gameplay.

Code: Select all

if scenetimer >= 3705 then
		function onDraw()
			Graphics.draw{
				type = RTYPE_IMAGE,
				image = title,
				x = camX,
				y = camY,
				priority = 0,
				sceneCoords = true
			}
		end
	end
Note: The scenetimer is just to display the image at the right time, title is the 256x256 PNG I want to show, and x and y are defined as player camera positions.
So I run the script and I get this error message:
Image
Anyone know any way I can correct this?

Added in 5 minutes 59 seconds:
Wait, does the image need to be in the folder of the respective level's script?

Re: Help with loading an image

Posted: Wed May 19, 2021 8:14 pm
by Hoeloe
You never loaded the title image, nor defined camX and camY. You need to use Graphics.loadImage to load the image you want, which will be relative to your level folder unless you also run the path through Misc.resolveFile.