-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbullet.cpp
More file actions
48 lines (36 loc) · 714 Bytes
/
Copy pathbullet.cpp
File metadata and controls
48 lines (36 loc) · 714 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
#include "bullet.h"
#include <SFML/Graphics.hpp>
#include <iostream>
Bullet::Bullet()
:radius(CELL/8) {
}
Bullet::Bullet(int newX, int newY, int colour) {
x = newX;
y = newY;
radius = CELL/8;
circle.setRadius(radius);
circle.setPosition(x,y);
if (colour == 0) {
circle.setFillColor(sf::Color::White);
}
else if (colour == 1) {
circle.setFillColor(sf::Color::Red);
}
}
Bullet::~Bullet() {
}
void Bullet::Update() {
}
void Bullet::Draw(sf::RenderWindow& window) {
window.draw(circle);
}
void Bullet::Move(int dir) {
y = y - 2*dir;
circle.setPosition(x,y);
}
int Bullet::GetX() {
return x;
}
int Bullet::GetY() {
return y;
}