-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathobstacle.h
47 lines (40 loc) · 982 Bytes
/
obstacle.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
#pragma once
#include "raylib.h"
enum class ObstacleType
{
top = 0, bottom, both
};
typedef struct Box
{
int x;
int y;
int bWidth;
int bHeight;
} Box ;
class Obstacle {
public:
Obstacle();
void Init(Texture2D* upPipeAddr, Texture2D* downPipeAddr);
void Update();
void Draw();
int GetPipePosition();
bool CheckCollide(Rectangle bird);
bool checkPassing(Rectangle bird);
void UnloadPipeTexture();
private:
Box upPipe;
Box downPipe;
int upPipeHeight;
int width;
int middleHeight;
int speed = 2;
ObstacleType type = ObstacleType::top;
bool isPassed = false;
bool bCollide = false;
// 텍스처 로드하기
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
Texture2D* UpPipePtr; // Texture loading;
Texture2D* DownPipePtr; // Texture loading;
Rectangle topRectImg;
Rectangle bottomRectImg;
};