GenBackground()


Background type constants are defined in the following include file.

include "Game Engine Constants.inc"

' Background Types
Const Background_Parallax = 1
Const Background_Fixed = 2
Const Background_Centered = 3
Const Background_Scrolling = 4
Const Background_Tiled = 5

The parameters on the GenBackground() function vary by the type of background being created.


background = GenBackground(Background_Parallax)

A parallax background takes no additional parameters besides the type. Parallax backgrounds are not backgrounds themselves, but rather contain layers of backgrounds of any other type.


background = GenBackground(Background_Fixed, tileset)

Create a fixed background from a tileset. The image in the tileset is scaled to fit the screen size.


background = GenBackground(Background_Centered, tileset)

Create a centered background from a tileset. The image in the tileset is centered on the screen without scaling.


background = GenBackground(Background_Scrolling, tileset {, xOffset, yOffset, xMargin, yMargin ) )

tileset

The graphics to be used for the background in the standard Game Engine format.

xOffset

The X offset used for positioning the background.

yOffset

The Y offset used for positioning the background.

xMargin

The X margin used for spacing between the background tiles.

yMargin

The Y margin used for spacing between the background tiles.

Create a scrolling background. Scrolling backgrounds tile or repeat a single tile all over the screen. This can be used for star field type backgrounds as well as long scrolling panoramic views.


background = GenBackground(Background_Tiled, TMXFilename$)

Create a tiled background from a TMX file.

TMX files are created using the free Tiled Map Editor available for PC and Mac.

Free Tiled Map Editor




Game Engine Overview







Become a Patron