-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbombs.h
55 lines (48 loc) · 1.35 KB
/
bombs.h
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
class Bomb
{
private:
public:
bool visible = false;
byte x = 0;
byte y = 0;
byte radius = 0;
void update(EnemyManager &enemym)
{
if (visible)
{
radius += 2;
if (radius > 200)
{
visible = false;
for (int j = 0; j < MAX_ENEMY_ON_STAGE; j++)
if ((enemym.enemies[j].enemystatus & 0b00001001) == 0b00001001)
enemym.enemies[j].enemystatus ^= 0b00000001;
} else
enemym.clrshoot();
}
}
void draw()
{
if (visible)
{
arduboy.drawCircle(x, y, radius, 1);
arduboy.drawCircle(x, y, radius - 4, 1);
}
}
void clr()
{
visible = false;
}
void checkcollisions(EnemyManager &enemym, ExplosionManager &explosionm)
{
if (visible)
for (int j = 0; j < MAX_ENEMY_ON_STAGE; j++)
if ((enemym.enemies[j].enemystatus & 0b00001001) == 0b00001000)
if (checkhitboxcr(x, y, radius, enemym.enemies[j].x + enemym.enemies[j].hitboxXPadding, enemym.enemies[j].y + enemym.enemies[j].hitboxYPadding, enemym.enemies[j].hitboxWidth, enemym.enemies[j].hitboxHeight))
{
byte damage = 3;
enemym.damageenemy(enemym.enemies[j], damage, explosionm);
enemym.enemies[j].enemystatus |= 0b00000001;
}
}
};