-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLevel1Gun.cpp
68 lines (62 loc) · 2.1 KB
/
Level1Gun.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
#include "Level1Gun.h"
#include "Application.h"
#include "ModuleCollisions.h"
#include "ModuleParticles.h"
#include "ModuleAudio.h"
#include "ModulePlayer.h"
#include "ModuleLevel1.h"
#include "ModuleLevel2.h"
Level1Gun::Level1Gun(int x, int y) : Weapon(x, y)
{
dropRight.PushBack({ 434, 8, 13, 3 });
dropLeft.PushBack({ 477, 54, 13, 3 });
if (App->lvl1->IsEnabled())
{
if (App->lvl1->currentDirection == App->lvl1->RIGHTDIR)
{
if (App->lvl1->currentPosition == App->lvl1->LEFTUP || App->lvl1->currentPosition == App->lvl1->RIGHTUP)
{
if (App->lvl1->currentPosition == App->lvl1->LEFTUP)
{
path.PushBack({ 7.0f + App->lvl1->cameraSpeed, (float)App->lvl1->cameraSpeed / App->lvl1->proportion }, 180, &dropRight);
}
else if (App->lvl1->currentPosition == App->lvl1->RIGHTUP)
{
path.PushBack({ 7.0f + App->lvl1->cameraSpeed, -(float)App->lvl1->cameraSpeed / App->lvl1->proportion }, 180, &dropRight);
}
}
else
{
path.PushBack({ 7.0f + App->lvl1->cameraSpeed, 0.0f }, 180, &dropRight);
}
}
else if (App->lvl1->currentDirection == App->lvl1->LEFTDIR)
{
if (App->lvl1->currentPosition == App->lvl1->LEFTUP || App->lvl1->currentPosition == App->lvl1->RIGHTUP)
{
if (App->lvl1->currentPosition == App->lvl1->RIGHTUP)
{
path.PushBack({ -7.0f - App->lvl1->cameraSpeed, (float)App->lvl1->cameraSpeed / App->lvl1->proportion }, 180, &dropLeft);
}
else if (App->lvl1->currentPosition == App->lvl1->LEFTUP)
{
path.PushBack({ -7.0f - App->lvl1->cameraSpeed, -(float)App->lvl1->cameraSpeed / App->lvl1->proportion }, 180, &dropLeft);
}
}
else
{
path.PushBack({ -7.0f - App->lvl1->cameraSpeed, 0.0f }, 180, &dropLeft);
}
}
}
collider = App->collisions->AddCollider({ position.x, position.y, 13, 3 }, Collider::Type::PLAYER_SHOT, (Module*)App->weapons);
}
void Level1Gun::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
Weapon::Update();
}