-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBigCamouflageJet.cpp
66 lines (56 loc) · 1.81 KB
/
BigCamouflageJet.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
#include "BigCamouflageJet.h"
#include "Application.h"
#include "ModuleCollisions.h"
#include "ModuleParticles.h"
#include "ModuleAudio.h"
#include "ModulePlayer.h"
#include "SetBulletDirection.h"
BigCamouflageJet::BigCamouflageJet(int x, int y,bool spawnRight) : Enemy(x, y,spawnRight)
{
flyRight.PushBack({ 126, 57, 32, 19 });
flyLeft.PushBack({ 387, 57, 32, 19 });
// Have the big camouflage jet describe a path in the screen
if (spawnRight) {
if (spawnPos.y < SCREEN_HEIGHT / 2) {
path.PushBack({ -3.0f, 0.0f }, 40, &flyLeft);
path.PushBack({ -3.0f, 1.0f }, 40, &flyLeft);
path.PushBack({ -3.0f, 0.0f }, 60, &flyLeft);
}
else {
path.PushBack({ -3.0f, 0.0f }, 40, &flyLeft);
path.PushBack({ -3.0f, -1.0f }, 40, &flyLeft);
path.PushBack({ -3.0f, 0.0f }, 60, &flyLeft);
}
}
else {
if (spawnPos.y < SCREEN_HEIGHT / 2) {
path.PushBack({ 3.0f, 0.0f }, 40, &flyRight);
path.PushBack({ 3.0f, 1.0f }, 40, &flyRight);
path.PushBack({ 3.0f, 0.0f }, 60, &flyRight);
}
else {
path.PushBack({ 3.0f, 0.0f }, 40, &flyRight);
path.PushBack({ 3.0f, -1.0f }, 40, &flyRight);
path.PushBack({ 3.0f, 0.0f }, 60, &flyRight);
}
}
collider = App->collisions->AddCollider({ position.x, position.y, 32, 19 }, Collider::Type::ENEMY, (Module*)App->enemies);
scoreGiven = 200;
moneyGiven = 600;
}
void BigCamouflageJet::Update()
{
path.Update();
position = spawnPos + path.GetRelativePosition();
currentAnim = path.GetCurrentAnimation();
// Call to the base class. It must be called at the end
// It will update the collider depending on the position
Enemy::Update();
shootingFrequency++;
if (shootingFrequency > 120)
{
shootingFrequency = 0;
SetBulletDirection(this);
App->particles->AddParticle(App->particles->enemyBullet, position.x + 32, position.y, Collider::Type::ENEMY_SHOT);
}
}