-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRepeater.cpp
More file actions
25 lines (24 loc) · 790 Bytes
/
Repeater.cpp
File metadata and controls
25 lines (24 loc) · 790 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
#include "Repeater.h"
Repeater::Repeater(int x, int y) : Plant(x, y, 100, "./SFML/images/c/repeater.png", "Repeater", 71, 71, 10, 200, 13,"./SFML/images/repeaterCard.png"), Shooter(&(Plant::pos),2.9, 20, "./SFML/images/peashooterBullet.png", 10, 15) {
shot = false;
}
//Function to burst shoot
Bullet* Repeater::shoot() {
Bullet* bullet = nullptr;
if (exists) {
bullet = Shooter::shoot();
shootSound.play();
if (bullet != nullptr) {
shot = true;
clock.restart();
return bullet;
}
if (shot && clock.getElapsedTime().asMilliseconds() > 175) {
clock.restart();
shot = false;
bullet = new Bullet(Shooter::pos->pos[0] + 40, Shooter::pos->pos[1] + 10, bulletSpeed, bulletSpritePath, Shooter::textureX, Shooter::textureY);
return bullet;
}
}
return bullet;
}