-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuffalo.cpp
81 lines (79 loc) · 1.35 KB
/
Buffalo.cpp
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
#include "CANIMAL.h"
Buffalo::~Buffalo()
{
}
Buffalo::Buffalo()
{
aX = 1;
aY = 17;
aState = false;
right = false;
}
void Buffalo::Draw(int x0, int y0)
{
HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(console, 143);
SetColor(6);
gotoXY(x0 + 7, y0 - 2);
cout << "(____)";
gotoXY(x0, y0 - 1);
cout << "`\\------(oo)";
gotoXY(x0 + 2, y0);
cout << "|| (__)";
gotoXY(x0 + 2, y0 + 1);
if (this->right == false)
{
cout << "//w---//";
this->right = true;
}
else
{
cout << "\\\\w---\\\\";
this->right = false;
}
SetConsoleTextAttribute(console, 0);
ShowCur(0);
}
void Buffalo::Delete(int x0, int y0)
{
gotoXY(x0 + 7, y0 - 2);
for (int i = 0; i < 6; ++i)
{
SetColor(8);
cout << char(219);
}
gotoXY(x0, y0 - 1);
for (int i = 0; i < 12; ++i)
{
SetColor(8);
cout << char(219);
}
gotoXY(x0 + 2, y0);
for (int i = 0; i < 12; ++i)
{
int z = x0 + i;
if ((z >= 4 && z <= 11) ||
(z >= 24 && z <= 31) ||
(z >= 44 && z <= 51) ||
(z >= 64 && z <= 71) ||
(z >= 84 && z <= 91))
{
gotoXY(z, y0);
SetColor(15);
cout << char(219);
}
else
{
gotoXY(z, y0);
SetColor(8);
cout << char(219);
}
}
gotoXY(x0 + 2, y0 + 1);
for (int i = 0; i < 8; ++i)
{
SetColor(8);
cout << char(219);
}
SetColor(8);
}