X-Git-Url: http://git.rohieb.name/hackover2013-badge-firmware.git/blobdiff_plain/01d395b92b5ba972a6e1c3d8f2bf4803f155a3cb..6e1f414fe8b4997ed96e5af5d31b066bfcd7c11b:/badge/jumpnrun/player.h?ds=sidebyside diff --git a/badge/jumpnrun/player.h b/badge/jumpnrun/player.h index 1b193b5..4277334 100644 --- a/badge/jumpnrun/player.h +++ b/badge/jumpnrun/player.h @@ -7,10 +7,11 @@ enum { // Do not collide with JUMPNRUN_MOVEABLE_* flags - JUMPNRUN_PLAYER_DEAD = 4 + JUMPNRUN_PLAYER_DEAD = 128 }; enum { + JUMPNRUN_PLAYER_TICKS_PER_FRAME = 6, JUMPNRUN_PLAYER_FRAMES = 4 }; @@ -21,7 +22,15 @@ typedef struct jumpnrun_player { uint8_t keys; } jumpnrun_player; -void jumpnrun_player_spawn (jumpnrun_player *self, vec2d spawn_pos, uint8_t lives); -void jumpnrun_player_respawn (jumpnrun_player *self, vec2d spawn_pos); +void jumpnrun_player_spawn (jumpnrun_player *self, vec2d spawn_pos, uint8_t lives); +void jumpnrun_player_respawn(jumpnrun_player *self, vec2d spawn_pos); +void jumpnrun_player_kill (jumpnrun_player *self); +void jumpnrun_player_despawn(jumpnrun_player *self); + +void jumpnrun_player_advance_animation(jumpnrun_player *self); + +static inline bool jumpnrun_player_alive(jumpnrun_player const *self) { + return (self->base.flags & (JUMPNRUN_PLAYER_DEAD | JUMPNRUN_MOVEABLE_DYING)) == 0; +} #endif