-
Notifications
You must be signed in to change notification settings - Fork 1
/
Enemy_Big_Eye.cpp
54 lines (33 loc) · 1.07 KB
/
Enemy_Big_Eye.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
#include "Application.h"
#include "Enemy_Big_Eye.h"
#include "ModuleCollision.h"
#include "ModuleParticles.h"
#include "SDL/include/SDL_timer.h"
Enemy_Big_Eye::Enemy_Big_Eye(int x, int y) : Enemy(x, y)
{
score = 5000;
fly.PushBack({ 11,10,70,68 });
fly.PushBack({ 88,10,70,68});
fly.PushBack({ 165,10,70,68 });
fly.PushBack({ 11,160,70,68 });
fly.PushBack({ 11,77,70,68 });
fly.PushBack({ 88,77,70,68 });
fly.PushBack({ 165,77,70,68 });
fly.PushBack({ 11,10,70,68 });
fly.speed = 0.065f;
animation = &fly;
path->PushBack({ 0 , 0 }, 2, &fly);
collider = App->collision->AddCollider({ 13, 10, 70, 68 }, COLLIDER_TYPE::COLLIDER_ENEMY, (Module*)App->enemies);
original_position.x = x;
original_position.y = y;
live = 1;
}
void Enemy_Big_Eye::Move()
{
position = original_position + path->GetCurrentPosition(&animation);
if (SDL_GetTicks() - shoot_delay >= 1000)
{
shoot_delay = SDL_GetTicks();
App->particles->AddParticle(App->particles->shrimp_shoot, position.x + fly.frames->w / 2, position.y + fly.frames->h / 2, COLLIDER_ENEMY, { -3,0});
}
}