Lebensscreen.
[hackover2013-badge-firmware.git] / badge / jumpnrun / jumpnrun.h
1 #ifndef INCLUDED_BADGE2013_JUMPNRUN_H
2 #define INCLUDED_BADGE2013_JUMPNRUN_H
3
4 #include "enemies.h"
5 #include "items.h"
6 #include "levels.h"
7 #include "tiles.h"
8
9 #include "../ui/sprite.h"
10 #include "../util/util.h"
11
12 #include <stdbool.h>
13 #include <stddef.h>
14
15 enum {
16 JUMPNRUN_PLAYING,
17 JUMPNRUN_DEAD,
18 JUMPNRUN_WON,
19 JUMPNRUN_ERROR
20 };
21
22 enum {
23 JUMPNRUN_MAX_SPAWN_MARGIN = BADGE_SPRITE_MAX_WIDTH + 1,
24 JUMPNRUN_MAX_SPAWNED_ENEMIES = 10
25 };
26
27 typedef struct jumpnrun_shot {
28 rectangle old_box;
29 rectangle current_box;
30 vec2d inertia;
31 uint8_t tick;
32 } jumpnrun_shot;
33
34 static inline bool jumpnrun_shot_spawned(jumpnrun_shot const *shot) { return fixed_point_ne(shot->inertia.x, FIXED_INT(0)); }
35 static inline void jumpnrun_shot_despawn(jumpnrun_shot *shot) { shot->inertia.x = FIXED_INT(0); }
36
37 enum {
38 JUMPNRUN_MAX_SHOTS = 2
39 };
40
41 typedef struct jumpnrun_game_state {
42 jumpnrun_moveable player;
43
44 uint8_t status;
45 int left;
46 uint8_t lives;
47 uint8_t keys;
48
49 jumpnrun_shot shots[JUMPNRUN_MAX_SHOTS];
50 } jumpnrun_game_state;
51
52 vec2d hacker_extents(void);
53 void jumpnrun_passive_movement(vec2d *inertia);
54 badge_sprite const *jumpnrun_hacker_symbol(void);
55
56 uint8_t jumpnrun_play(char const *lvname);
57
58 #endif
This page took 0.052493 seconds and 5 git commands to generate.