-
Notifications
You must be signed in to change notification settings - Fork 0
/
player.h
76 lines (65 loc) · 1.61 KB
/
player.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef LOST_IN_SPACE_PLAYER
#define LOST_IN_SPACE_PLAYER
#include "splashkit.h"
#include <vector>
using namespace std;
#define PLAYER_SPEED 1.5
#define PLAYER_ROTATE_SPEED 3
#define SCREEN_BORDER 100
/**
* Different options for the kind of ship.
* Adjusts the image used.
*/
enum ship_kind
{
UFO1,
UFO2,
UFO3
};
/**
* The player data keeps track of all of the information related to the player.
*
* @field player_sprite The player's sprite - used to track position and movement
* @field score The current score for the player
* @field kind Current kind of player ship
*/
struct player_data
{
sprite player_sprite;
int score;
int level;
int infection;
ship_kind kind;
double cheese_pct;
double health_pct;
double burger_pct;
double duck_pct;
double horse_pct;
double cake_pct;
double virus_pct;
};
/**
* Creates a new player in the centre of the screen with the default ship.
* Returns the power up amounts.
* @returns The new player data
*/
player_data new_player();
/**
* Draws the player to the screen.
*
* @param player_to_draw The player to draw to the screen
*/
void draw_player(const player_data &player_to_draw);
/**
* Actions a step update of the player - moving them and adjusting the camera.
*
* @param player_to_update The player being updated
*/
void update_player(player_data &player_to_update);
/**
* Read user input and update the player based on this interaction.
*
* @param player The player to update, decreases fuel and life as time increases
*/
void handle_input(player_data &player);
#endif