Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: EntityGroup

[20:7] extends: EntityWorldListener

Wraps FXGL's EntityGroup (com.almasb.fxgl.entity.EntityGroup), an auto-updating filtered view of entities by one or more entity-type enums. The group listens for world add/remove events and keeps its own list of active matching entities for efficient frame-by- frame iteration. Build one with the GameWorld instance, initial entity list, and the list of type enums to track.

Methods

  • EntityGroup (object WorldObj, list Initial, list TypeEnums)

    Creates an EntityGroup tracking the supplied enum types.

    • @p WorldObj is a GameWorld wrapper.
    • @p Initial is a list of Entity wrappers seeded into the group.
    • @p TypeEnums is a list of AussomJavaObject enum values (one per type to track).
  • size ()

    Returns the number of active entities in the group.

  • getEntitiesCopy ()

    Returns the active entities as a list of Entity wrappers.

  • forEach (callback Action)

    Calls Action(entity) for each active entity.

    • @p Action is a callback (entityAjo) -> void.
    • @r this object
  • dispose ()

    Disposes the group, unsubscribing from world events.

  • getSize ()

    Returns the count of entities currently in this group.