Graphics.loadImage

From Moondust Wiki
Revision as of 08:53, 18 September 2015 by Sambo (talk | contribs) (→‎Usage)
Jump to navigation Jump to search

This function is used to load an image into the resource memory of SMBX. This image can be displayed with other functions in the Graphics category.

Usage

First, you need an image to use. The image MUST be in .png format, or it may not display correctly. The image can have true transparency; a mask image is not required. To use this function, you must set a variable that contains it:

img = Graphics.loadImage("test.png")

"test.png" can now be displayed. In a function for showing the image, set the variable you used as the argument for "LuaImageResource":

Graphics.placeSprite(1, img, 0, 0)

This will load "test.png" on the screen at position [0,0] (the top left corner).