-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.h
44 lines (37 loc) · 809 Bytes
/
types.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Types and Defines
#ifndef TEXTINVADER_TYPES
#define TEXTINVADER_TYPES
// Defs
#define BULLET_UP 0
#define BULLET_DOWN 1
#define INVADER_LEFT -1
#define INVADER_RIGHT 1
#define MAX_PLAYER_BULLETS 5
#define MAX_PLAYER_LIVES 3
#define MAX_INVADERS 50
#define MAX_EXPLOSIONS 100
#define MAX_HISCORES 5
// Types
typedef struct bullet {
int oldX, oldY, X, Y;
bool active;
int direction;
} bullet;
typedef struct player {
int oldX, oldY, X, Y, maxX, maxY, lives, score;
bullet bullets[MAX_PLAYER_BULLETS];
} player;
typedef struct invader {
int oldX, oldY, X, Y;
bool active;
bullet bullet;
} invader;
typedef struct explosion {
int X, Y, xEnd, yEnd, frames;
bool active;
} explosion;
typedef struct hiscore {
int score, wave;
char name[4];
} hiscore;
#endif