Milky2018/selene/entity does not have a README file
let parent = @entity.Entity()
let child1 = parent.spawn_child()
let child2 = parent.spawn_child()
let children = parent.get_children()
inspect(children.length(), content="2")
inspect(child1 == children[0], content="true")
inspect(child2 == children[1], content="true")
parent.destroy()let parent = @entity.Entity()
let child = parent.spawn_child()
inspect(child.get_parent().unwrap() == parent, content="true")
inspect(parent.get_parent(), content="None")
parent.destroy()let parent = @entity.Entity()
let child = parent.spawn_child()
let standalone = @entity.Entity()
inspect(child.is_child(), content="true")
inspect(standalone.is_child(), content="false")
parent.destroy()
standalone.destroy()let parent = @entity.Entity()
@transform.transforms().set(parent, @transform.Transform::from_xyz(100.0, 100.0, 0.0))
let child = parent.spawn_child()
@transform.transforms().set(child, @transform.Transform::from_xyz(10.0, 5.0, 0.0))
inspect(parent.get_children().length(), content="1")
inspect(child.is_child(), content="true")
parent.destroy()@entity.entity_flush_system(0.0)
let root1 = @entity.Entity()
let root2 = @entity.Entity()
let child1 = root1.spawn_child()
let _grandchild = child1.spawn_child()
// root1 and root2 are roots (parents but not children)
// child1 is not a root (it's both a parent and a child)
let roots = @entity.get_roots().collect()
inspect(roots.length(), content="1")
root1.destroy()
root2.destroy()ECS game engine in MoonBit
Dependencies