# rmp::behavior::Runner

> Constant forward motion that SPEEDS UP over time, with a jump and a duck.

Source: https://omardev29.github.io/rmp-docs/reference/behaviors/Runner.html

behavior `#include <rmp/behavior.h>` [include/rmp/behavior.h:193](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/behavior.h#L193-L225)

struct 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 `speed` gains per second. 0 = constant |
| `max_speed` | `float` | `900` | The most `speed` is allowed to reach, units per second |
| `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 `{ .speed = 320 }` stops compiling — which is the whole design. The name is the fence. |

### `distance`

float distance() const

function [include/rmp/behavior.h:206](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/behavior.h#L206)

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`

bool ducking() const

function [include/rmp/behavior.h:209](https://github.com/omardev29/raylib_multiplatform/blob/982bf2a1e307c49776bff84211260703b8de6895/include/rmp/behavior.h#L209)

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.
