DrawableParallaxLayer

Extends: Drawable

Scrolls a tiled/non-tiled bitmap layer at a configurable per-axis fraction of the camera's movement (parallax). {1,1} is the default and behaves exactly like an ordinary drawable; {0,0} pins the layer to the camera; 0 < factor < 1 is a background layer that drifts slower than the world; factor > 1 is a foreground layer that scrolls faster. See SceneObjectParallaxLayer for the actual per-frame math.

Combines with the owning entity's position/offset exactly like every other Drawable - there is no special "independent of owner" positioning mode. Attach this to a dedicated static entity if you want a fixed background anchor.

Properties

  • region (roRegion) — The bitmap tile to scroll/repeat.
  • parallaxFactor (BGE.Math.Vector) — Per-axis fraction of camera movement this layer scrolls at. See the class doc for ' what different values mean.
  • repeatX (boolean) — Whether this layer tiles to cover the canvas along each axis. repeatX defaults true ' (the common side-scroller case); repeatY defaults false.
  • repeatY (boolean)

Constructor

new DrawableParallaxLayer( owner: BGE.GameEntity, region: roRegion, args?: roAssociativeArray, ): DrawableParallaxLayer

Parameters

  • owner (BGE.GameEntity)
  • region (roRegion)
  • args (roAssociativeArray, optional, default: "{}")

Instance Methods

addToScene(rendererObj: Renderer): BGE.SceneObject

Parameters

Returns