-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCells.pde
55 lines (49 loc) · 1003 Bytes
/
Cells.pde
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
class Cells
{
boolean hasMoved = false;
int size = 10, positionX , positionY, velocityX , velocityY;
int state = 0; // 0 - AIR, 1 - ROCK, 2 - SAND, 3 - WATER, 4 - OIL, 5 - FIRE
Cells(int posX_, int posY_, int state_, int size_)
{
size = size_;
state = state_;
positionX = posX_;
positionY = posY_;
}
void reset(int posX_, int posY_)
{
positionX = posX_;
positionY = posY_;
}
void update(boolean moved)
{
hasMoved = moved;
}
void drawing()
{
switch (state) {
case 0:
fill(255, 255, 255);
break;
case 1:
fill(128, 128, 128);
break;
case 2:
fill(255, 255, 0);
break;
case 3:
fill(0, 0, 255);
break;
case 4:
fill(160, 70, 160);
break;
case 5:
fill(255, 70, 0);
break;
default:
fill(255, 0, 0);
break;
}
rect(positionX, positionY, size, size);
}
}