Levelauswahl auf Badge.
[hackover2013-badge-firmware.git] / badge / jumpnrun / player.h
1 #ifndef INCLUDED_BADGE_JUMPNRUN_PLAYER_H
2 #define INCLUDED_BADGE_JUMPNRUN_PLAYER_H
3
4 #include "moveable.h"
5 #include "../ui/display.h"
6 #include "../util/util.h"
7
8 enum {
9 // Do not collide with JUMPNRUN_MOVEABLE_* flags
10 JUMPNRUN_PLAYER_DEAD = 128
11 };
12
13 enum {
14 JUMPNRUN_PLAYER_TICKS_PER_FRAME = 6,
15 JUMPNRUN_PLAYER_FRAMES = 4
16 };
17
18 typedef struct jumpnrun_player {
19 jumpnrun_moveable base;
20
21 uint8_t lives;
22 uint8_t keys;
23 } jumpnrun_player;
24
25 void jumpnrun_player_spawn (jumpnrun_player *self, vec2d spawn_pos, uint8_t lives);
26 void jumpnrun_player_respawn(jumpnrun_player *self, vec2d spawn_pos);
27 void jumpnrun_player_kill (jumpnrun_player *self);
28 void jumpnrun_player_despawn(jumpnrun_player *self);
29
30 void jumpnrun_player_advance_animation(jumpnrun_player *self);
31
32 static inline bool jumpnrun_player_alive(jumpnrun_player const *self) {
33 return (self->base.flags & (JUMPNRUN_PLAYER_DEAD | JUMPNRUN_MOVEABLE_DYING)) == 0;
34 }
35
36 #endif
This page took 0.060333 seconds and 5 git commands to generate.