Back to index

Functions to draw and move around sprites on the screens.



Sprite.LoadPalette( screen, palettenumber, palettefile )

Loads a palette.

screen is the screen that the palette will be loaded to. It can be 1 (top screen) or 0 (bottom screen).
palettenumber can be any unique number from other palettes. You will use it to identify this palette with your sprite(s).
palettefile is the .pal file that will be loaded. (Ex: "sprite.pal")





Sprite = Sprite.Create( SpriteFrames, framenumber, palettenumber, x, y )

Creates a sprite and draws it onto the screen.

SpriteFrames is the variable that you will have loaded the .raw file into (see Frame Strip functions).
framenumber is the frame that you want it to start on (frame 0 is the first one and should be used if there is only one frame.)
palettenumber is the number that you made in the Sprite.LoadPalette() function.
x, y are the coordinates on the screen of where to draw the sprite (the top-left pixel). X is from 0 to 255, Y is from 0 to 191.

Sprite is the variable that is used in other functions to control the sprite.





Sprite:SetFrame( SpriteFrames, framenumber )

Sets the sprite to a new frame.

SpriteFrames is the variable that you will have loaded the .raw file into (see Frame Strip functions).
framenumber is the frame that you want to change to. The first frame is frame 0.





Sprite:MoveTo( x, y )

Moves the sprite to a different location on the screen, instantly.

x, y are the new coordinates of the sprite. X can be 0 to 255, Y can be 0 to 191.





Sprite:Free()

Frees a sprite from memory and erases it from the screen. The sprite must be set to frame 0 before freeing because of a bug in DSLua 0.5.


Back to index