-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEnemy.class.cpp
executable file
·69 lines (62 loc) · 1.45 KB
/
Enemy.class.cpp
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include <iostream>
#include <string>
#include "IElement.class.hpp"
#include "Enemy.class.hpp"
#include "Bullet.class.hpp"
Enemy::Enemy(void)
{
std::cout << "Enemy : Default constructor called." << std::endl;
return ;
}
Enemy::Enemy(const Enemy &src): IElement(src)
{
*this = src;
std::cout << "Enemy : Copy constructor called." << std::endl;
return ;
}
Enemy::Enemy(int pv, int posX, int posY, int sizeX, int sizeY, int speed, std::string *skin, std::string type, int rateOfFire): IElement(pv, posX, posY, sizeX, sizeY, speed, skin), _type(type), _rateOfFire(rateOfFire)
{
std::cout << "Enemy : Param constructor called" << std::endl;
return ;
}
Enemy::~Enemy(void)
{
std::cout << "Enemy : Destructor called." << std::endl;
return ;
}
Enemy &Enemy::operator=(const Enemy &rhs)
{
if (this != &rhs)
{
this->setHp(rhs.getHp());
this->setPosX(rhs.getPosX());
this->setPosY(rhs.getPosY());
this->setSizeX(rhs.getSizeX());
this->setSizeY(rhs.getSizeY());
this->setSpeed(rhs.getSpeed());
this->setSkin(rhs.getSkin());
this->setType(rhs.getType());
this->setRateOfFire(rhs.getRateOfFire());
}
return (*this);
}
void Enemy::die(void)
{
// blabla
}
std::string Enemy::getType(void) const
{
return (this->_type);
}
void Enemy::setType(std::string type)
{
this->_type = type;
}
unsigned int Enemy::getRateOfFire(void) const
{
return (this->_rateOfFire);
}
void Enemy::setRateOfFire(unsigned int rateOfFire)
{
this->_rateOfFire = rateOfFire;
}