-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcoin.cpp
More file actions
50 lines (50 loc) · 680 Bytes
/
coin.cpp
File metadata and controls
50 lines (50 loc) · 680 Bytes
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
#include "coin.hpp"
#include <graphics.h>
Coin::Coin(int _x, int _y, int _r, int _speed, int _color, int _screenHeigh, bool _type)
{
x = _x;
y = _y;
r = _r;
speed = _speed;
color = _color;
screenHeight = _screenHeigh;
type = _type;
}
void Coin::draw()
{
setcolor(color);
setfillstyle(SOLID_FILL, color);
circle(x, y, r);
floodfill(x, y, color);
}
void Coin::update()
{
if (y + r > screenHeight)
{
y = 0;
}
else
{
y += speed;
}
}
void Coin::reset()
{
y = 0;
}
int Coin::getX()
{
return x;
}
int Coin::getY()
{
return y;
}
int Coin::getR()
{
return r;
}
bool Coin::getType()
{
return type;
}