Documentation
¶
Overview ¶
Package move advances path-following agents across a shared flow field.
Agents are intentionally generic: tower-defense enemies use them today; player-controlled units can reuse the same Transform + Agent stores later. Combat stats (health, reward, armor) stay in game-specific components.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClampRect ¶ added in v0.0.3
ClampRect keeps the axis-aligned box (tr.X, tr.Y, width, height) inside bounds.
func FollowFlow ¶
func FollowFlow( agents *ecs.Store[Agent], transforms *ecs.Store[Transform], field *pathing.Field, g *grid.Grid, tileSize float64, dt float64, )
FollowFlow moves every entity that has both Agent and Transform along field.
Each tick:
- Refresh the cell cache from world position.
- Aim at the center of the next flow-field cell (or stop at the exit).
- Integrate position by Speed * dt toward that target.
Agents on unreachable tiles do not move. tileSize must match the grid used to build field. g may be nil if you only need field sampling (cell refresh still uses tileSize alone).
Types ¶
type Agent ¶
Agent is path-following state for enemies and later player units.
CellX/CellY cache the tile the agent occupies; FollowFlow refreshes them when the world position crosses a tile boundary.
type Bounds ¶ added in v0.0.3
type Bounds struct {
X, Y, W, H float64
}
Bounds is an axis-aligned rectangle (top-left + size).