Spring class final
A pad that throws whatever stands on it.
A trigger rather than a solid: the runner walks over it and is thrown, which is one rule. A solid pad would need a second — what happens when you land on its edge — and every platformer that has tried has produced the bug where a player bounces sideways into a pit.
Properties
- collider → Collider
-
final
- firedThisStep ↔ bool
-
True on the step it fired, for a sound and a squash.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- name → String?
-
What other entities call this one, when anything does.
finalinherited
- origin → Vector3
-
Where this is, for anything that wants to make a noise there.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- speed → double
-
How fast it throws. 15 m/s clears about 4.7 m against the runner's
gravity, which is two and a half times a jump and reads as a launch.
final
- world → MechanismWorld
-
The world this belongs to, once it has been added to one.
no setterinherited
Methods
-
activate(
Activation by) → ActivationOutcome -
collect(
MechanismEvents into) → void -
Reports what happened to this mechanism since the last collection.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onCollision(
Collider self, Collider other) → void - Still overlapping and still worth firing: a runner who lands on a pad and is thrown may come back down onto it before the overlap ever ends, and a spring that only answers on entry would quietly stop working.
-
onCollisionEnd(
Collider self, Collider other) → void -
inherited
-
onCollisionStart(
Collider self, Collider other) → void -
restore(
Map< String, Object?> from) → void - Puts back what save took. Given the same map it produced.
-
save(
) → Map< String, Object?> -
Nothing. A pad has a speed and a collider and no memory:
firedThisStepis cleared by the step that publishes it, so there is no moment at which a save could catch it holding anything. -
step(
double dt) → void -
Advances by
dt. Called every simulation step, for every mechanism. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited