rmp::behavior::Runner
Constant forward motion that SPEEDS UP over time, with a jump and a duck.
A Platformer with the x fixed is not this, and the difference is accelerate and distance(): in an endless runner the speed climbs on its own, and the distance travelled is both the score and the clock the difficulty hangs off — and a Spawner with every_distance and track set to the runner produces by that same distance rather than by time.
Added to an object with add<rmp::behavior::Runner>(); the framework calls its _ready, _update with the object it is on.
Fields
| Field | Type | Default | What it is |
|---|---|---|---|
speed | float | 320 | Units per second, right now |
accelerate | float | 6 | How much |
max_speed | float | 900 | The most |
gravity | float | 2200 | Units per second squared, pulling down while off the ground |
jump | float | 720 | The upward speed a jump starts with, in units per second |
air_jumps | int | 0 | 1 = a double jump |
jump_action | std::string | Empty = ui_accept | |
duck_action | std::string | Held to duck; empty = it never ducks | |
ours | struct { … } | What it is keeping track of. Readable, because sometimes you want it; not yours to write. It is one PUBLIC member and not a private block because a struct with a private member is not an aggregate in C++20, and then |
distance
How far it has run, in units: speed summed over every update since it was added. It counts the running, not where the object got to.
ducking
Whether duck_action was held at its last update. That is all ducking does here: a smaller collider or another animation is the game's to set.