Skip to main content

Entity

The Entity type represents an entity in the game world. Fields or properties can also be attached to entities to store data. Behaviors can be attached to entities to give them functionality. Various other components like sprites and colliders can also be attached to an entity. When an entity is despawned, all of its components are terminated. See the main page on Entities to learn more about them.

prop projectile.MyProperty

pub fn behavior this.MyBehavior() { }

Spawn projectile { // create an entity called 'projectile'
MyProperty = 123 // this property will be stored on the projectile
MyBehavior // this behavior will expire when the projectile expires
on MyProperty { // this 'on' hook will be terminated when the projectile expires
// do something whenever MyProperty changes
}
}