Aego Русский

Go

if hp, ok := scene.Get[gameplay.Health](s, node); ok {
  hp.Damage(3, attacker)
}
if m, ok := scene.Get[gameplay.Motion2D](s, player); ok {
  m.AddVelocity(mathx.Vec2{X: 6, Y: -4})
}
st := gameplay.Of(world).Stats()

The component types and their methods are the same as in scripts. gameplay.Of(world) returns the service of a play world; its Stats method counts hits, deaths, respawns and pickups since Play started.

State machines call script hooks through the script.call contract (contracts/scriptcall): Method(node, name, params) finds a plain method of a script on a node, Call runs it, and a new Generation after a hot reload makes old references stale. The save section gameplay.respawn holds the respawn points marked Persist.

Motion 2D reads and moves bodies only through the physics2d.queries contract: CastBody from a moved pose, Penetration, BodyPose, BodyVelocity, MoveKinematic, Teleport and Gravity. A physics module that provides the contract runs the controller unchanged. Root motion reaches the controller through the motion2d.receiver contract (contracts/motion2d): AddDisplacement(node, offset) returns false for a node without Motion 2D.