Home

Module bkg

Lua bindings to interact with the background. An example would be:
 

Functions

bkg.clear () Clears any backgrounds that may currently be displaying.
bkg.image (image, x, y, move, scale, col, foreground) Adds a background image.


Functions

bkg.clear ()
Clears any backgrounds that may currently be displaying.
bkg.image (image, x, y, move, scale, col, foreground)
Adds a background image. If the colour parameter is a boolean it's treated as the foreground parameter instead.

Parameters

  • image: Image to use.
  • x: X position.
  • y: Y position.
  • move: Fraction of a pixel to move when the player moves one pixel.
  • scale: How much to scale the image.
  • col: Colour to tint image (optional parameter).
  • foreground: Whether or not it should be rendered above the stars (optional parameter ). Defaults to false.

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

Return value:

ID of the background.

Valid XHTML 1.0!