jengine-parallax
Parallax scrolling background package for jEngine — multi-layer depth-based scrolling.
| Kind | Built-in: linked into the stock runtime and editor viewport |
| Source | packages/jengine-parallax |
| Version | 0.1.0 |
| Entry point | jengine_parallax::ParallaxPackage |
| Script namespace | Parallax |
Using it
Section titled “Using it”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.
Components
Section titled “Components”| Scene key | Rust type | |
|---|---|---|
parallax_layer | ParallaxLayer | package only: needs a v2 scene |
Script commands
Section titled “Script commands”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.
| Call | Flat name |
|---|---|
Parallax.set(e, x, y) | parallax_set |
Parallax.set_auto_scroll(e, x, y) | parallax_set_auto_scroll |
Scenes that use it
Section titled “Scenes that use it”projects/arcade-classics/assets/scenes/ironnebula.sceneprojects/arcade-classics/assets/scenes/peak1.sceneprojects/arcade-classics/assets/scenes/peak2.sceneprojects/arcade-classics/assets/scenes/peak3.sceneprojects/engine-test-lab/assets/scenes/59-packages.sceneprojects/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).
What it registers
Section titled “What it registers”| Component | Is |
|---|---|
parallax_layer | scroll_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.
From scripts
Section titled “From scripts”| Call | Does |
|---|---|
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.