PolygonEntity
The base of a game entity whose body is a polygon: a PolygonNode subclass, so the entity is its node — geometry, style, and tags — plus whatever facts the game class adds.
An entity is a value like any node: it moves by rebinding (ball *= motion replaces the variable with the moved entity), and every shape-preserving operation returns through copy, which this class re-abstracts — the compiler forces each entity class to say how it is rebuilt, carrying its facts across (Ball(PolygonNode(polygon, style, tags)).also { it.velocity = velocity }). Facts a subclass adds (a velocity, a charge) are plain mutable properties; the inherited identity stays structural and fact-exclusive — an entity that needs fact-sensitive equality folds its facts in locally over super.equals.
Parameters
The node value the entity starts as.
Constructors
Roots the entity at node's geometry, style, and tags.
Properties
Functions
Returns this entity rebuilt around polygon — the hook every shape-preserving operation returns through, re-abstracted so each entity class must implement it.