-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpearl.h
88 lines (77 loc) · 1.79 KB
/
pearl.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
#pragma once
#include "ofMain.h"
#include "basic.h"
#include <cstdlib>
//已整理
class pearl
{
public :
pearl(bool _who):bRemove(false),bBombing(false),who(_who),size(50),bTargeted(false){};
bool bRemove;
bool bTargeted;
bool bBombing;
color attribute;
int number;
bool who;//1->player1
int size;
int posX,posY;
float radius;
float timePearlBombed;
void draw()
{
if(this->bRemove == false)
{
switch(this->attribute)
{
case 0:
ofSetHexColor(0xff0000);
break;
case 1:
ofSetHexColor(0xffff00);
break;
case 2:
ofSetHexColor(0x00ff00);
break;
case 3:
ofSetHexColor(0x00ffff);
break;
case 4:
ofSetHexColor(0x9900ff);
break;
case 5:
ofSetHexColor(0xff44aa);
break;
}
if(this->bTargeted == true)
ofDrawBox(this->posX,this->posY,5,this->size);
else
ofRect(this->posX,this->posY,this->size,this->size);
if(this->bBombing == true)
{
ofSetHexColor(0xffffff);
ofDrawBox(this->posX,this->posY,15,this->size-=0.3);
}
}
}
void update()
{
if(who)
{
posX = 50+(number%6)*50;
posY = 150+(number/6)*50;
}
else
{
posX = 650+(number%6)*50;
posY = 150+(number/6)*50;
}
if(bBombing)
{
float timeBombed = ofGetElapsedTimef() - timePearlBombed;
if(timeBombed > 0.3)
{
this->bRemove = true;
}
}
}
};