Describe changing the collision layer during a run and Layer of (#211)
- Colliders: new section "Changing the layer while the game runs". The Properties node of type Collider writes layer and collidesWith, and Layer of names the layer of an object. - Colliders: the line saying a ray is not filtered by layers was outdated, Raycast has its own Layers filter. - Behaviors: Layer of in the list of nodes. - Development: 1619 editor checks.
1 parent
21704ca03c
commit
412b94a064
3 files changed
+24
-3
No files matched your search
+1
-1
@@ -228,7 +228,7 @@ playing use the same two words.
|
|||||||
normalized direction, so diagonals are not faster), `Compare` (two numbers count as equal up to
|
normalized direction, so diagonals are not faster), `Compare` (two numbers count as equal up to
|
||||||
float noise, a relative 1e-9, so `time - late == 6` holds without a `Round`; `Equals` does the
|
float noise, a relative 1e-9, so `time - late == 6` holds without a `Round`; `Equals` does the
|
||||||
same for two numbers, and for a number against a typed text that is a number, like `130`), `And/Or/Not`, `Key is down`,
|
same for two numbers, and for a number against a typed text that is a number, like `130`), `And/Or/Not`, `Key is down`,
|
||||||
`Mouse position`, `Mouse button`, `Is hovered`, `Is touching`, `Animation playing` (whether an animation runs on an object, its progress and time left) and `Animation length` (see [Animations](Animations)), `Get velocity`, `Current state` (name and id), `Is in state` (one boolean per state) ·
|
`Mouse position`, `Mouse button`, `Is hovered`, `Is touching`, `Layer of` (the collision layer of an object by name and number, see [Colliders](Colliders)), `Animation playing` (whether an animation runs on an object, its progress and time left) and `Animation length` (see [Animations](Animations)), `Get velocity`, `Current state` (name and id), `Is in state` (one boolean per state) ·
|
||||||
actions `Move` (dx, dy, scale, dt — connect an event's dt for per-second movement; in the object's own axes, which a turned parent turns too; with *Collide with solids* it slides along what it hits, less friction, and outputs `blocked x/y`, `hit` and the contact `normal x/y`, see [Colliders](Colliders)), `Set position`, `Spawn`
|
actions `Move` (dx, dy, scale, dt — connect an event's dt for per-second movement; in the object's own axes, which a turned parent turns too; with *Collide with solids* it slides along what it hits, less friction, and outputs `blocked x/y`, `hit` and the contact `normal x/y`, see [Colliders](Colliders)), `Set position`, `Spawn`
|
||||||
(asset input + x/y/z, optional parent → outputs the new object; the asset is picked on the node or arrives over an edge, from an `Asset` node, a variable or a list item. A pick saved while it was still a setting reads as that input's value, so older projects spawn as before; the same holds for the asset of `Is asset`), `Destroy` (removes the object with everything below it; with **keep children** on, only the object goes: its children move up to its parent (top level when it had none) and keep their place, rotation and size in the world, and the output `children` is the list of them, nearest level only. Its behaviors and its rigidbody go with it either way. In the editor run, children that are content of a placed container move up for the run only: their place belongs to the template, so the scene does not learn it), `Emit` (starts a particle source over, see *Particles*),
|
(asset input + x/y/z, optional parent → outputs the new object; the asset is picked on the node or arrives over an edge, from an `Asset` node, a variable or a list item. A pick saved while it was still a setting reads as that input's value, so older projects spawn as before; the same holds for the asset of `Is asset`), `Destroy` (removes the object with everything below it; with **keep children** on, only the object goes: its children move up to its parent (top level when it had none) and keep their place, rotation and size in the world, and the output `children` is the list of them, nearest level only. Its behaviors and its rigidbody go with it either way. In the editor run, children that are content of a placed container move up for the run only: their place belongs to the template, so the scene does not learn it), `Emit` (starts a particle source over, see *Particles*),
|
||||||
`Play sound` / `Stop sound` (see [Sounds](Sounds): the asset says how loud and whether it loops, the node's
|
`Play sound` / `Stop sound` (see [Sounds](Sounds): the asset says how loud and whether it loops, the node's
|
||||||
|
|||||||
+22
-1
@@ -158,10 +158,31 @@ does not have to be changed as well, but the shots have to name what they *shoul
|
|||||||
being blocked, use **Trigger (no blocking)**.
|
being blocked, use **Trigger (no blocking)**.
|
||||||
- It filters everything alike — the engine in Play, `Move` with *Collide with solids*, and the
|
- It filters everything alike — the engine in Play, `Move` with *Collide with solids*, and the
|
||||||
collision events of the editor run.
|
collision events of the editor run.
|
||||||
- A ray is not filtered by layers yet, that is #158.
|
- A ray has a filter of its own, **Layers** on the Raycast node (see below).
|
||||||
- Only the *last* layer can be removed in the dialog: a collider names its layer by number, so
|
- Only the *last* layer can be removed in the dialog: a collider names its layer by number, so
|
||||||
taking one out of the middle would move every collider below it onto another layer.
|
taking one out of the middle would move every collider below it onto another layer.
|
||||||
|
|
||||||
|
### Changing the layer while the game runs
|
||||||
|
|
||||||
|
A behavior changes both settings with a **Properties** node of type *Collider* (#211): add
|
||||||
|
`layer` or `collidesWith` under `+ Property`, switch the port to *Set*, and the node shows the same
|
||||||
|
picker as the inspector — the project's layers by name, or a tick per layer. For a figure that is
|
||||||
|
invulnerable for a moment, a ghost that walks through walls, a carried crate that stops blocking.
|
||||||
|
|
||||||
|
- The node takes the **collider itself**, not the object it sits on: `Child by name` of the owner,
|
||||||
|
or the `collider` output of a collision event or of Raycast.
|
||||||
|
- It holds from the next `Move`, the next ray and the next physics step on, in the editor run and
|
||||||
|
in Play alike. A dynamic body resting on ground it no longer meets starts to fall.
|
||||||
|
- A pair that still meets after the change reports no new *enter* or *exit*.
|
||||||
|
- Read the same way, `layer` is the number of the layer (0 for the first), not its name.
|
||||||
|
- **Layer of** gives the name: it takes an object and answers `name` (as the project calls the
|
||||||
|
layer) and `number`. An object stands for its first collider child, switched on or not; a collider
|
||||||
|
or tilemap for itself. Without a collider the name is empty and the number -1. It answers at the
|
||||||
|
moment it is asked, so right after a *Set* in the same flow it already names the new layer. Feed
|
||||||
|
`name` into `Equals` to branch on the layer.
|
||||||
|
- Like every change a graph makes, it lasts for the run in Play; the editor run writes it into the
|
||||||
|
scene.
|
||||||
|
|
||||||
## Raycast
|
## Raycast
|
||||||
|
|
||||||
The **Raycast** node (#153) casts a ray from `from x/y` along `dir x/y` (any length, it is made a
|
The **Raycast** node (#153) casts a ray from `from x/y` along `dir x/y` (any length, it is made a
|
||||||
|
|||||||
+1
-1
@@ -18,7 +18,7 @@ php tests/php/accounts.test.php # the API's accoun
|
|||||||
# has and the web server's container has not (SKIP there)
|
# has and the web server's container has not (SKIP there)
|
||||||
php tests/php/snapshots.test.php # the snapshot store (#231), the same way
|
php tests/php/snapshots.test.php # the snapshot store (#231), the same way
|
||||||
php tests/php/releases.test.php # the release store (#266), the same way
|
php tests/php/releases.test.php # the release store (#266), the same way
|
||||||
node tools/seed-e2e.mjs && node tools/e2e.mjs # 1617 editor checks, screenshots in /tmp/gm-e2e-*.png
|
node tools/seed-e2e.mjs && node tools/e2e.mjs # 1619 editor checks, screenshots in /tmp/gm-e2e-*.png
|
||||||
GM_STEPS=20 node tools/e2e.mjs # or 1-12, or 6,20 — a subset while working on one step
|
GM_STEPS=20 node tools/e2e.mjs # or 1-12, or 6,20 — a subset while working on one step
|
||||||
./e2e.sh start [GM_STEPS] # the same run detached, see below
|
./e2e.sh start [GM_STEPS] # the same run detached, see below
|
||||||
./e2e.sh status # live progress, or the last run's result
|
./e2e.sh status # live progress, or the last run's result
|
||||||
|
|||||||
Reference in new issue
Block a user