-
Notifications
You must be signed in to change notification settings - Fork 1
/
Enemy_BossS4Face.cpp
83 lines (64 loc) · 2.14 KB
/
Enemy_BossS4Face.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#include "Application.h"
#include "Enemy_BossS4Face.h"
#include "ModuleCollision.h"
#include "ModuleParticles.h"
#include"ModuleSceneStage4.h"
#include "SDL/include/SDL_timer.h"
/* FALTA CAMBIAR EL SPRITE DEL DISPAR*/
Enemy_BossS4Face::Enemy_BossS4Face(int x, int y) : Enemy(x, y)
{
fly.PushBack({360,157,56,50 });
/*
fly.PushBack({ 305,155,52,50 });
fly.PushBack({ 255,155,56,50 });
fly.PushBack({ 210,155,56,50 });
fly.PushBack({ 370,105,56,50 });
fly.PushBack({ 320,105,56,50 });
fly.PushBack({ 270,105,56,50 });
fly.PushBack({ 215,105,56,50 });
fly.PushBack({ 160,105,56,50 });*/
fly.speed = 0.08f;
fly.loop = false;
animation = &fly;
//path to do
path->PushBack({ -2 , -1 }, 40, &fly);
//path->PushBack({ -2 , 0 }, 80, &fly);
up = false;
immortal = true;
live = 40;
collider = App->collision->AddCollider({ 5, 5, 56, 50 }, COLLIDER_TYPE::COLLIDER_ENEMY, (Module*)App->enemies);
original_position.x = x;
original_position.y = y;
}
void Enemy_BossS4Face::Move()
{
if (App->scene_stage4->move_head) {
if (position.x <= 4800) {
original_position.x = 4800;
if (SDL_GetTicks() - shoot_delay >= 100 && SDL_GetTicks() - move_delay <= 400)
{
shoot_delay = SDL_GetTicks();
App->particles->AddParticle(App->particles->shrimp_shoot, original_position.x, original_position.y + fly.frames->h / 2, COLLIDER_ENEMY_SHOT, { -2,-0.5f });
App->particles->AddParticle(App->particles->shrimp_shoot, original_position.x, original_position.y + fly.frames->h / 2, COLLIDER_ENEMY_SHOT, { -2,0.5f });
}
if(SDL_GetTicks() - move_delay > 400){
if (original_position.y > 50 && up)
original_position.y--;
else if (original_position.y < SCREEN_HEIGHT - 100 && !up)
original_position.y++;
if (original_position.y <= 50 || original_position.y >= SCREEN_HEIGHT - 100)
up = !up;
position = original_position + newpath->GetCurrentPosition(&animation);
}
if(SDL_GetTicks() - move_delay > 1500)
move_delay = SDL_GetTicks();
}
else {
position = original_position + path->GetCurrentPosition(&animation);
if (position.x <= 4800) {
original_position.x = 4800;
original_position.y = 35;
}
}
}
}