-
Notifications
You must be signed in to change notification settings - Fork 1
/
Enemy_Blue_Ball.cpp
42 lines (33 loc) · 1.19 KB
/
Enemy_Blue_Ball.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
#include "Application.h"
#include "Enemy_Blue_Ball.h"
#include "ModuleCollision.h"
#include "ModuleParticles.h"
#include "SDL/include/SDL_timer.h"
Enemy_Blue_Ball::Enemy_Blue_Ball(int x, int y) : Enemy(x, y)
{
fly.PushBack({ 3,87,35,26 });
fly.PushBack({ 3,55,35,22 });
fly.PushBack({ 45,6,35,22 });
fly.PushBack({ 2,31,35,22 });
fly.PushBack({ 3,6,35,22 });
fly.PushBack({ 2,31,35,22 });
fly.PushBack({ 45,6,35,22 });
fly.PushBack({ 3,55,35,22 });
fly.speed = 0.1f;
animation = &fly;
path->PushBack({ 0 , 0 }, 2, &fly);
collider = App->collision->AddCollider({ 0, 0, 32, 22 }, COLLIDER_TYPE::COLLIDER_ENEMY, (Module*)App->enemies);
original_position.x = x;
original_position.y = y;
live = 2;
}
void Enemy_Blue_Ball::Move()
{
position = original_position + path->GetCurrentPosition(&animation);
if (SDL_GetTicks() - shoot_delay >= 2000)
{
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_SHOT, { -1,1 });
App->particles->AddParticle(App->particles->shrimp_shoot, position.x + fly.frames->w / 2, position.y + fly.frames->h / 2, COLLIDER_ENEMY_SHOT, { 1,1 });
}
}