# rmp::behavior::Animator

> Plays the tag that fits what the object is doing: `die` once its Health is dead, `hurt` while it is invulnerable after a hit, `jump` and `fall` in the air (with gravity), `run` while it moves and `idle` while it does not -- and mirrors it with flip_x by the way it moves.

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

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

struct Animator

Plays the tag that fits what the object is doing: `die` once its Health is dead, `hurt` while it is invulnerable after a hit, `jump` and `fall` in the air (with gravity), `run` while it moves and `idle` while it does not — and mirrors it with flip_x by the way it moves. The names are fields, the tags of your .aseprite; a tag the sheet lacks is skipped for the next that fits, and without a sheet only flip_x is set. Runs after everything has moved.

Added to an object with `add<rmp::behavior::Animator>()`; the framework calls its `_late_update` with the object it is on.

## Fields

| Field | Type | Default | What it is |
|---|---|---|---|
| `idle` | `std::string` | `"idle"` | Standing still, on the ground |
| `run` | `std::string` | `"run"` | Moving faster than `moving_at` |
| `jump` | `std::string` | `"jump"` | In the air, going up (with gravity) |
| `fall` | `std::string` | `"fall"` | In the air, coming down (with gravity) |
| `hurt` | `std::string` | `"hurt"` | While its Health is invulnerable after a hit |
| `die` | `std::string` | `"die"` | Played once, not looped |
| `moving_at` | `float` | `10` | Units per second under which it stands still |
| `flip` | `bool` | `true` | Sets flip_x while it moves left; the art faces right |
| `rules` | `std::vector<AnimationRule>` |  | Asked first, in order |
| `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. |

### `playing`

std::string_view playing() const

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

The tag it chose at its last update; "" when it chose none.
