-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGF_Hook.cpp
53 lines (48 loc) · 1.38 KB
/
GF_Hook.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
#include "GF_Hook.h"
#include "Application.h"
#include "ModuleCollisions.h"
#include "ModuleParticles.h"
#include "ModuleAudio.h"
#include "GreenFighterPlane.h"
#include "ModulePlayer.h"
GF_Hook::GF_Hook(int x, int y,unsigned int number) : Weapon(x, y)
{
hookNum = number;
hook.PushBack({ 0, 219, 16, 5 });
hook.PushBack({ 24, 211, 16, 21 });
hook.PushBack({ 55, 210, 29, 23 });
hook.speed = 0.08f;
hook.loop = false;
path0.PushBack({ 1.5f, 0.5f }, 20, &hook);
path0.PushBack({ -1.5f, 0 }, 60, &hook);
path0.PushBack({ -3.5f, 0 }, 30, &hook);
path0.PushBack({ -4.0f, 0 }, 10, &hook);
path0.loop = false;
path1.PushBack({ 1.5f, -0.5f }, 20, &hook);
path1.PushBack({ -1.5f, 0 }, 60, &hook);
path1.PushBack({ -3.5f, 0 }, 30, &hook);
path1.PushBack({ -4.0f, 0 }, 10, &hook);
path1.loop = false;
collider = App->collisions->AddCollider({ position.x, position.y, 29, 23 }, Collider::Type::ENEMY_SHOT, (Module*)App->weapons);
}
void GF_Hook::Update()
{
switch (hookNum)
{
case 0:
path0.Update();
position = spawnPos + path0.GetRelativePosition();
currentAnim = path0.GetCurrentAnimation();
break;
case 1:
path1.Update();
position = spawnPos + path1.GetRelativePosition();
currentAnim = path1.GetCurrentAnimation();
break;
default:
break;
}
// Call to the base class. It must be called at the end
// It will update the collider depending on the position
Weapon::Update();
}