Module bkg
Lua bindings to interact with the background.
An example would be:
`
Functions
clear () | Clears any backgrounds that may currently be displaying. |
image (image, x, y[, move=0[, scale=1[, angle=0[, col=nil[, foreground=false]]]]]) | Adds a background image. |
Functions
- clear ()
- Clears any backgrounds that may currently be displaying.
- image (image, x, y[, move=0[, scale=1[, angle=0[, col=nil[, foreground=false]]]]])
-
Adds a background image.
If the colour parameter is a boolean it's treated as the foreground parameter instead.
Parameters:
- image Tex Image to use.
- x number X position.
- y number Y position.
- move number Fraction of a pixel to move when the player moves one pixel. A value of 0 indicates static and centered. (default 0)
- scale number How much to scale the image. (default 1)
- angle Rotation , in radians. (default 0)
- col Colour Colour to tint image. (default nil)
- foreground boolean Whether or not it should be rendered above the space dust. (default false)
Returns:
-
number
ID of the background.
Usage:
bkg.image( img, 0, 0, 0.1, 1. ) -- Adds the image without scaling that moves at 0.1 the player speed
bkg.image( img, 0, 0, 0.1, 1., true ) -- Now on the foreground
bkg.image( img, 0, 0, 0.1, 1., col.new(1,0,0) ) -- Now with colour
bkg.image( img, 0, 0, 0.1, 1., col.new(1,0,0), true ) -- Now with colour and on the foreground