-
Notifications
You must be signed in to change notification settings - Fork 0
/
Powerups.h
73 lines (50 loc) · 1.29 KB
/
Powerups.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
#ifndef POWERUPS_H
#define POWERUPS_H
#include <SDL/SDL.h>
#include "Define.h"
#include "SDL_Base.h"
/** Class Powerups: Abstract base class for the different powerups that appear on the game. */
class Powerups
{
public:
Powerups(int i);
virtual void Picked(int player) = 0;
bool OnCreate(SDL_Surface* Surf_Dest);
protected:
bool active;
int affects_on;
int type;
public:
SDL_Surface* PU;
SDL_Rect pu;
};
/** Class Sprint: powerup that doubles the player's speed. Inherits from Powerups class. */
class Sprint : public Powerups
{
public:
Sprint() : Powerups(1) {}
void Picked(int player);
};
/** Class Tron: powerup that makes the player turn 90º. Inherits from Powerups class. */
class Tron : public Powerups
{
public:
Tron() : Powerups(2) {}
void Picked(int player);
};
/** Class Worm: powerup that makes the player move to its starting position and
move in the opposite direction. Inherits from Powerups class. */
class Worm : public Powerups
{
public:
Worm() : Powerups(3) {}
void Picked(int player);
};
/** Class Sprint: powerup that makes the walls crossable. Inherits from Powerups class. */
class VanishWalls : public Powerups
{
public:
VanishWalls() : Powerups(4) {}
void Picked(int player);
};
#endif // POWERUPS_H