-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMetalBullet.cpp
More file actions
25 lines (21 loc) · 894 Bytes
/
MetalBullet.cpp
File metadata and controls
25 lines (21 loc) · 894 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 <allegro5/base.h>
#include <random>
#include <string>
#include "DirtyEffect.hpp"
#include "Enemy.hpp"
#include "MetalBullet.hpp"
#include "Group.hpp"
#include "PlayScene.hpp"
#include "Point.hpp"
class Turret;
MetalBullet::MetalBullet(Engine::Point position, Engine::Point forwardDirection, float rotation, Turret* parent) :
Bullet("play/bullet-1.png", 300, 2, position, forwardDirection, rotation - ALLEGRO_PI / 2, parent) {
// TODO 3 (2/5): You can imitate the 2 files: 'WoodBullet.hpp', 'WoodBullet.cpp' to create a new bullet.
}
void MetalBullet::OnExplode(Enemy* enemy) {
std::random_device dev;
std::mt19937 rng(dev());
std::uniform_int_distribution<std::mt19937::result_type> dist(2, 5);
getPlayScene()->GroundEffectGroup->AddNewObject(new DirtyEffect("play/dirty-1.png", dist(rng), enemy->Position.x, enemy->Position.y));
enemy->Slow(0.5, 5);
}