-
Notifications
You must be signed in to change notification settings - Fork 0
/
Object.h
98 lines (92 loc) · 2.15 KB
/
Object.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#ifndef HEADERS
#define HEADERS
#include "SDL2/SDL.h"
#include "SDL2/SDL_image.h"
#include "SDL2/SDL_mixer.h"
#include <stdio.h>
#include <string>
#include <ctime>
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include "SDL2/SDL_ttf.h"
#endif
#ifndef OBJECT_H_INCLUDED
#define OBJECT_H_INCLUDED
class obstacle{
private:
SDL_Rect mCollider;
bool exist;
public:
virtual void render() = 0;
virtual void init() = 0;
virtual void reset() = 0;
virtual void set_false() = 0;
virtual int get_y() = 0;
virtual bool get_exist() = 0;
};
class Wood {
friend class Balloon;
private:
const int height;
SDL_Rect mCollider;
public:
Wood();
Wood(int x,int y);
~Wood(){}
void render();
void reset();
void operator+=(int t);
void Init(int);
};
class Bat :public obstacle{
friend class Balloon;
private:
SDL_Rect mCollider;
bool exist;
public:
Bat();
Bat(int x,int y);
~Bat(){}
void render();
void init();
void reset();
void set_false() {exist = false;}
int get_y() {return mCollider.y;}
bool get_exist() {return exist;}
void operator+=(int &t);
void operator=(Bat &t);
};
class Shield :public obstacle{
friend class Balloon;
private:
SDL_Rect mCollider;
bool exist;
public:
Shield();
~Shield(){}
void render();
void init();
void reset();
void set_false() {exist = false;}
int get_y() {return mCollider.y;}
bool get_exist() {return exist;}
void operator+=(int t);
};
class Thunder
{
friend class Balloon;
private:
bool strike;
bool exist;
int cnt;
SDL_Rect mCollider;
public:
Thunder();
Thunder& operator++();
void set_true() {exist = true;}
void reset();
void render();
};
#endif // OBJECT_H_INCLUDED