-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBulletClass.cpp
More file actions
78 lines (68 loc) · 1.77 KB
/
BulletClass.cpp
File metadata and controls
78 lines (68 loc) · 1.77 KB
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
70
71
72
73
74
75
76
77
78
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* BulletClass.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dzui <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/11/05 21:33:20 by dzui #+# #+# */
/* Updated: 2017/11/05 21:34:51 by dzui ### ########.fr */
/* */
/* ************************************************************************** */
#include "BulletClass.hpp"
BulletClass::BulletClass()
{
posX = 0;
posY = 0;
hp = 0;
map_nb = 7;
}
BulletClass::BulletClass(int **map, int y, int x)
{
hp = 1;
map_nb = 7;
if (y - 1 != 0 && map[y - 1][x] == 0)
{
posY = y - 1;
posX = x;
map[posY][posX] = map_nb;
}
}
BulletClass::~BulletClass()
{
}
BulletClass::BulletClass(const BulletClass &ob)
{
posX = ob.posX;
posY = ob.posY;
hp = ob.hp;
map_nb = ob.map_nb;
}
BulletClass &BulletClass::operator=(const BulletClass &ob)
{
hp = ob.hp;
posY = ob.posY;
posX = ob.posX;
map_nb = ob.map_nb;
return (*this);
}
void BulletClass::moveObstacle(int **map)
{
map[posY][posX] = 0;
posY--;
map[posY][posX] = map_nb;
}
void BulletClass::generatePosition(int **map, int y, int x)
{
if (posY == 0)
map[posY][posX] = 1;
else
map[posY][posX] = 0;
posY = y - 1;
posX = x;
map[posY][posX] = map_nb;
}
void BulletClass::setHP()
{
hp = 1;
}