Skip to content

jengine-parallax

Parallax scrolling background package for jEngine — multi-layer depth-based scrolling.

KindBuilt-in: linked into the stock runtime and editor viewport
Sourcepackages/jengine-parallax
Version0.1.0
Entry pointjengine_parallax::ParallaxPackage
Script namespaceParallax

The stock runtime, web build and editor viewport are compiled with this package, so there is nothing to link. A project that has a settings.enabled_packages list must name it there, since that list is an allow-list once it exists; a project without the key gets every built-in.

{ "settings": { "enabled_packages": ["jengine-parallax"] } }

A scene that uses its components must be a v2 scene ("version": 2): a v1 scene has no field for a package component and keeps it as inert custom data.

A script can check that the package is linked with if Parallax == nil then return end.

Scene keyRust type
parallax_layerParallaxLayerpackage only: needs a v2 scene

Commands run in every runtime and return nothing; a package publishes what scripts read onto components (see the notes below). The flat name also works.

CallFlat name
Parallax.set(e, x, y)parallax_set
Parallax.set_auto_scroll(e, x, y)parallax_set_auto_scroll
  • projects/arcade-classics/assets/scenes/ironnebula.scene
  • projects/arcade-classics/assets/scenes/peak1.scene
  • projects/arcade-classics/assets/scenes/peak2.scene
  • projects/arcade-classics/assets/scenes/peak3.scene
  • projects/engine-test-lab/assets/scenes/59-packages.scene
  • projects/engine-test-lab/assets/scenes/78-scroller.scene

From packages/jengine-parallax/README.md.

Parallax scrolling: background layers that move slower than the camera and foreground layers that move faster, so a flat scene reads as deep.

This is a built-in package: the native runtime, the web runtime and the editor viewport are compiled with it. Unlike physics, audio and particles it has no hard-coded path in any runtime - its parallax_scroll system runs only because each host runs package systems, which is what made it the package that proved the package system works (scene 59 in the Engine Test Lab).

ComponentIs
parallax_layerscroll_factor_x / _y (0 stays put on screen, 1 moves with the world, above 1 is foreground), repeat_x / _y with repeat_width / _height to wrap a strip, offset_x / _y, auto_scroll_x / _y in units per second, and z_order_override.

parallax_layer is a package component: a scene that uses it must be a v2 scene ("version": 2).

The layer’s transform is rewritten every frame at PreRender from the active camera, so set the layer up through the component, not by moving it.

CallDoes
Parallax.set(e, x, y)Set the scroll factors.
Parallax.set_auto_scroll(e, x, y)Set the auto-scroll speed.

Both work in every runtime. The older flat globals set_parallax and set_parallax_auto_scroll are installed by the native runtime only (they are ScriptApiRegistry handlers, which the editor and web do not run) - use the Parallax namespace.

See the Parallax guide.