SimpleMovementComponent class

Moves an entity straight from a vector action — no physics. For top-down games, cursors and quick tests.

Inheritance

Constructors

SimpleMovementComponent({double speed = 220.0, String action = 'move', int playerIndex = 0, bool normalizeDiagonal = true, double deadZone = 0.05})
Movement steered by player 1's move action at 220 world units per second, diagonals capped to full speed, with a 0.05 dead zone.

Properties

action ↔ String
The vector action that steers it.
getter/setter pair
componentType → Type
Type identifier for this component
no setterinherited
deadZone ↔ double
Directions this long or shorter count as no push: the entity does not move and lastDirection is zero.
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
lastDirection ↔ Offset
Runtime-only resolved direction, not serialised.
getter/setter pair
normalizeDiagonal ↔ bool
Whether a direction longer than 1 (two keys held at once) is scaled back to length 1, so moving diagonally is no faster.
getter/setter pair
playerIndex ↔ int
Whose: 0 for player 1, -1 for anyone.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
speed ↔ double
Speed at a full push (vector length 1), in world units per second.
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onAttach(EntityId entityId) → void
Called when this component is added to an entity.
inherited
onDetach(EntityId entityId) → void
Called when this component is removed from an entity.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited