Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Marc Flerackers edited this page Mar 23, 2025 · 2 revisions

Changing the parent is now possible by simply assigning a new parent. A function to preserve the current transformation is available as well.

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