X-Git-Url: https://git.rohieb.name/hackover2013-badge-firmware.git/blobdiff_plain/74e337691a69a709aaa85569f312ba0493645ad3..05db94c84b6f7e4ee91fd67d6e1a8d97a2b97f2e:/badge/jumpnrun/moveable.h diff --git a/badge/jumpnrun/moveable.h b/badge/jumpnrun/moveable.h index 016a059..786b5df 100644 --- a/badge/jumpnrun/moveable.h +++ b/badge/jumpnrun/moveable.h @@ -11,6 +11,11 @@ enum { JUMPNRUN_MOVEABLE_DYING = 4 }; +enum { + JUMPNRUN_SPLOSION_FRAMES = 4, + JUMPNRUN_SPLOSION_TICKS_PER_FRAME = 15 +}; + typedef struct jumpnrun_moveable { rectangle hitbox; vec2d inertia; @@ -24,5 +29,8 @@ typedef struct jumpnrun_moveable { static inline bool jumpnrun_moveable_touching_ground(jumpnrun_moveable const *self) { return self->flags & JUMPNRUN_MOVEABLE_TOUCHING_GROUND; } static inline bool jumpnrun_moveable_mirrored (jumpnrun_moveable const *self) { return self->flags & JUMPNRUN_MOVEABLE_MIRRORED ; } +static inline bool jumpnrun_moveable_dying (jumpnrun_moveable const *self) { return self->flags & JUMPNRUN_MOVEABLE_DYING ; } + +static inline bool jumpnrun_moveable_finished_dying (jumpnrun_moveable const *self) { return jumpnrun_moveable_dying(self) && self->tick_minor >= JUMPNRUN_SPLOSION_FRAMES * JUMPNRUN_SPLOSION_TICKS_PER_FRAME; } #endif