-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBigOrangeJet.cpp
55 lines (45 loc) · 1.42 KB
/
BigOrangeJet.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
#include "BigOrangeJet.h"
#include "Application.h"
#include "ModuleCollisions.h"
#include "ModuleParticles.h"
#include "ModuleAudio.h"
#include "ModulePlayer.h"
#include "ModuleLevel2.h"
#include "SetBulletDirection.h"
BigOrangeJet::BigOrangeJet(int x, int y, bool spawnRight) : Enemy(x, y, spawnRight)
{
flyRight.PushBack({ 126, 20, 32, 19 });
flyLeft.PushBack({ 387,20,32,19 });
// Have the big orange jet describe a path in the screen
if (spawnRight == false)
{
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, &flyLeft);
path.PushBack({ -3.0f, -1.0f }, 40, &flyLeft);
path.PushBack({ -3.0f, 0.0f }, 60, &flyLeft);
}
collider = App->collisions->AddCollider({ position.x, position.y, 32, 19 }, Collider::Type::ENEMY, (Module*)App->enemies);
scoreGiven = 200;
moneyGiven = 600;
}
void BigOrangeJet::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);
}
}