sge.BackgroundLayer

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

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.

Attributes:

  • 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.

Read-Only Attributes:

  • id – The unique identifier of the layer.

sge.BackgroundLayer Methods

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

Create a background layer object.

Arguments:

  • id – The unique identifier of the sprite. If set to None, the id attribute of the sprite will be used, modified by 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 BackgroundLayer for more information.

Table Of Contents

Previous topic

sge.Sprite

Next topic

sge.Background

This Page