Basics
Guides
API Reference
Basics
Guides
API Reference
[24:7] extends: FxObj
Wraps FXGL's EntityBuilder
(com.almasb.fxgl.dsl.EntityBuilder), the fluent setup over a
fresh Entity() used by every FXGL sample's EntityFactory
@Spawns methods. Originally skipped per the no-builders
rule, then pulled into scope because several FXGL DSL surfaces
hand a builder back to the caller and the new Entity() +
setter alternative becomes painful at scale.
Construct via fxgl.entityBuilder() (empty) or
fxgl.entityBuilder(spawnData) (from a SpawnData wrapper).
Type-overloaded Kotlin methods become distinct Aussom names
(atVec2, atPoint2D, etc.) because Aussom cannot pick
between two same-arity object signatures.
EntityBuilder (Ajo = null)
Wraps an existing EntityBuilder AussomJavaObject (the usual entry, since
fxgl.entityBuilder()returns a wrapper with the AJO already populated).
Ajo is an optional AussomJavaObject around an EntityBuilder.adopt (object Ajo)
Wraps an existing EntityBuilder AussomJavaObject.
from (object DataObj)
Seeds the builder from the given SpawnData (sets position, type if present, and copies every key into the entity's properties). Use
fxgl.entityBuilder(data)instead of constructing a blank builder and calling this — the upstream method is@Deprecatedin favour of that form.
DataObj is a SpawnData wrapper.type (object EnumAjo)
Sets the entity type (FXGL collision-handler dispatch key).
EnumAjo is a Java Enum AJO (use aji.getStaticMember("com.example.MyType", "PLAYER")).at (double X, double Y)
Sets the entity 2D position.
at (double X, double Y, double Z)
Sets the entity 3D position.
atVec2 (object VecObj)
Sets position from a Vec2 wrapper.
atPoint2D (object PointAjo)
Sets position from a Point2D AJO.
atPoint3D (object PointAjo)
Sets position from a Point3D AJO.
atAnchored (object LocalAnchorAjo, object PositionAjo)
Sets the local anchor and the anchored position together.
LocalAnchorAjo is a Point2D AJO (entity-local coords).PositionAjo is a Point2D AJO (world coords).anchorFromCenter ()
Sets the local anchor to the center of the bounding box.
rotationOrigin (double X, double Y)
Sets the rotation origin in entity-local coords.
rotationOriginPoint (object PointAjo)
Sets the rotation origin from a Point2D AJO.
rotate (double Angle)
Rotates the entity by the given angle in degrees.
scaleOrigin (double X, double Y)
Sets the scale origin in entity-local coords.
scaleOriginPoint (object PointAjo)
Sets the scale origin from a Point2D AJO.
scale (double X, double Y)
Sets X / Y scale.
scale (double X, double Y, double Z)
Sets X / Y / Z scale.
scalePoint (object PointAjo)
Sets scale from a Point2D or Point3D AJO.
opacity (double Value)
Sets the view opacity (0.0 - 1.0).
bbox (object HitBoxObj)
Adds a HitBox bounding box to the entity.
HitBoxObj is a HitBox wrapper.bboxShape (object ShapeAjo)
Adds a BoundingShape bounding box (FXGL auto-wraps it in a HitBox before adding).
ShapeAjo is a BoundingShape AJO.view (object NodeObj)
Adds a JavaFX Node as the entity view.
NodeObj is an object whose .obj field is the JavaFX Node AJO (or pass a raw AJO and the call still works).viewTexture (string TextureName)
Adds a view loaded from the asset loader by texture name (e.g. "player.png"). Resolves through FXGL.texture(...).
viewUrl (string UrlString)
Adds a view loaded from a URL string (assets outside the asset loader's resource set).
viewWithBBox (object NodeObj)
Adds a JavaFX Node as the entity view AND sizes the bounding box to the node's layout bounds.
viewWithBBoxTexture (string TextureName)
viewWithBBox by texture name.
viewWithBBoxUrl (string UrlString)
viewWithBBox by URL string.
zIndex (int Z)
Sets the entity z-index that drives draw-order sorting.
onClick (callback Cb)
Attaches a click handler to the entity view. The Aussom callback receives the Entity AJO (wrap with
new Entity(ajo)to get the typed wrapper).
Cb is a callback (entityAjo) -> any.onActive (callback Cb)
Attaches an on-active handler. The Aussom callback receives the Entity AJO.
onNotActive (callback Cb)
Attaches an on-not-active handler. The Aussom callback receives the Entity AJO.
neverUpdated ()
Marks the entity as never-updated so its onUpdate hooks (and component onUpdate methods) are skipped.
collidable ()
Shortcut for
with(CollidableComponent(true)).
with (object ComponentObj)
Attaches a single Component to the entity.
ComponentObj is a Component wrapper (or any wrapper whose .obj field is the Java Component AJO).withComponents (list ComponentList)
Attaches multiple Components in one call. Pass a list of Component wrappers.
ComponentList is a list of Component wrappers.withProperty (string Key, Value)
Sets a per-entity property under the given key.
Key is the property name.Value is the property value (any).build ()
Finalises and returns the constructed Entity wrapper.
buildAndAttach ()
Builds the entity and adds it to the game world. Returns the new Entity wrapper. Do not use when spawning through
GameWorld.spawn/FXGL.spawn— usebuild()instead to avoid a double-add.
buildScreenBounds (double Thickness)
Builds an entity carrying four LEFT / RIGHT / TOP / BOT HitBoxes around the current screen plus a PhysicsComponent, and returns it. Does NOT attach to the world — call
buildScreenBoundsAndAttachfor that. The standalonefxgl.buildScreenBoundsAndAttach(thickness)shortcut is still preferred for the common case.
Thickness is the wall thickness in pixels.buildScreenBoundsAndAttach (double Thickness)
Builds the screen-bounds entity (see
buildScreenBounds) and attaches it to the world.
Thickness is the wall thickness in pixels.buildOrigin3D ()
Builds a 3D origin gizmo entity (yellow sphere at origin, red / green / blue 1-unit axis boxes). Used for 3D scene debugging.
buildOrigin3DAndAttach ()
buildOrigin3D + add to world.

Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.