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. 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 |
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 |
playing
The tag it chose at its last update; "" when it chose none.