Skip to content
Marc Flerackers edited this page Jun 9, 2024 · 1 revision

Changing the parent is currently not possible. The parent component will give both an alternative to add(), and a way to change the parent afterwards.

const ball = add([
  sprite(),
  name("ball"),
  parent(leftFoot)
])

// Detach the ball from the foot and attach it to the root when kicked
ball.parent = null

Caveats:

  • Changes to the hierarchy will only affect the scene in the next frame. Before update is called, the object list needs to be collected and fixed.
Clone this wiki locally