Aego Русский

In scripts

var enemies []NodeRef

func Ready() {
  for i := 0; i < 64; i++ {
    enemies = append(enemies, nil)
  }
}

func Update(dt float) {
  n := scene.WithTag("Enemy", enemies)
  for i := 0; i < n; i++ {
    debug.Circle(enemies[i].WorldPosition(), 0.5, Color{1, 0, 0, 1})
  }
}
Function
node.HasTag(t), node.AddTag(t), node.RemoveTag(t) tags of one node
scene.WithTag(tag, out) int enabled nodes with the tag, in the order they got it
scene.WithComponent(name, out) int enabled nodes with the component ("Body2D" or the full name)
scene.InArea(rect, mask, out) int bodies touching the rectangle on the layers in mask when physics runs; otherwise enabled 2D nodes whose position lies in it
scene.ByID(id) NodeRef the node with an id from the scene file

Queries write at most len(out) nodes and allocate nothing; size the slice once. They see the enabled state of the last transform pass. Without physics a node is a point: the core does not know the size of a sprite or a mesh, and InArea ignores mask.