-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnemyBullet.cpp
More file actions
40 lines (35 loc) · 852 Bytes
/
EnemyBullet.cpp
File metadata and controls
40 lines (35 loc) · 852 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
#include "EnemyBullet.h"
EnemyBullet::EnemyBullet()
{
bulletColor = sf::Color::Red;
bulletSpeed = 5.f;
collidedPlayer = false;
resolutionHeight = 0.f;
}
EnemyBullet::EnemyBullet(int windowHeight, sf::Vector2f enemyPosition)
: Bullet(windowHeight, enemyPosition)
{
initVariables(windowHeight);
initShape(enemyPosition);
}
void EnemyBullet::initVariables(int windowHeight)
{
bulletColor = sf::Color::Red;
bulletSpeed = 5.f;
collidedPlayer = false;
this->resolutionHeight = windowHeight;
}
void EnemyBullet::initShape(sf::Vector2f enemyPosition)
{
line.setFillColor(bulletColor);
line.setSize(sf::Vector2<float>(bulletSizeX, bulletSizeY));
line.setOrigin(line.getSize().x / 2, 0.f);
line.setPosition(enemyPosition.x, enemyPosition.y);
}
void EnemyBullet::moveBullet()
{
line.move(0.0f, bulletSpeed);
}
EnemyBullet::~EnemyBullet()
{
}