sge.BackgroundLayer

class sge.BackgroundLayer(sprite, x, y, z, ID=None, xscroll_rate=1, yscroll_rate=1, xrepeat=True, yrepeat=True)

Special class used for background layers.

This class stores a sprite and certain information for a layer of a background. In particular, it stores the location of the layer, whether the layer tiles horizontally, vertically, or both, and the rate at which it scrolls.

sprite

The sprite used for this layer. It will be animated normally if it contains multiple frames.

x

The horizontal location of the layer relative to the background.

y

The vertical location of the layer relative to the background.

z

The Z-axis position of the layer in the room.

xscroll_rate

The horizontal rate that the layer scrolls as a factor of the additive inverse of the horizontal movement of the view.

yscroll_rate

The vertical rate that the layer scrolls as a factor of the additive inverse of the vertical movement of the view.

xrepeat

Whether or not the layer should be repeated (tiled) horizontally.

yrepeat

Whether or not the layer should be repeated (tiled) vertically.

id

The unique identifier of the layer. (Read-only)

sge.BackgroundLayer Methods

BackgroundLayer.__init__(sprite, x, y, z, ID=None, xscroll_rate=1, yscroll_rate=1, xrepeat=True, yrepeat=True)

Constructor method.

Arguments:

  • ID – The value to set id to. If set to None, sprite.id will be used, modified by the SGE if it is already the unique identifier of another background layer.

All other arguments set the respective initial attributes of the layer. See the documentation for sge.BackgroundLayer for more information.

BackgroundLayer.destroy()

Destroy the background layer.

Table Of Contents

Previous topic

sge.Sprite

Next topic

sge.Background

This Page