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
84
85
86
87
88
89
90
91
92
93
94
95
|
#include "EnemyFactory.h"
#include <memory>
#include <raylib.h>
#include "ArcGenerator.h"
#include "ConstantVelocity.h"
#include "Enemy.h"
#include "FallingAndOscillating.h"
Enemy
EnemyFactory::make_small(
ConstantVelocityBullet::Vector& bullets,
const float x, const float y,
const float hold,
const bool mirror)
{
auto position = std::make_shared<Vector2>(Vector2{x, y});
auto generator = std::make_shared<ArcGenerator>(position, bullets);
auto behaviour = std::make_shared<FallingAndOscillating>(position, generator);
generator->m_interval = 1.2f;
generator->m_speed = 60;
generator->m_segments = 15;
generator->m_radius = 5;
if (mirror) {
generator->m_color = Color{100, 0, 255, 255};
generator->m_rotation = -0.2f;
generator->m_angle = 1.f;
behaviour->m_phase = 1.f;
}
else {
generator->m_rotation = 0.2f;
}
Enemy enemy(position, generator, behaviour);
enemy.m_hold = hold;
return enemy;
}
Enemy
EnemyFactory::make_thick(
ConstantVelocityBullet::Vector& bullets,
const float x, const float y,
const float hold,
const float angle)
{
auto position = std::make_shared<Vector2>(Vector2{x, y});
auto generator = std::make_shared<ArcGenerator>(position, bullets);
auto behaviour = std::make_shared<Falling>(position, generator);
generator->m_interval = 2.3f;
generator->m_arc = 0.3f;
generator->m_angle = 0.5f;
generator->m_last = true;
generator->m_segments = 25;
generator->m_radius = 9;
generator->m_color = Color{160, 30, 50, 200};
generator->m_angle = angle;
behaviour->m_speed = 20;
Enemy enemy(position, generator, behaviour);
enemy.m_hold = hold;
return enemy;
}
Enemy
EnemyFactory::make_rotator(
ConstantVelocityBullet::Vector& bullets,
const float x, const float y,
const float hold,
const bool mirror)
{
auto position = std::make_shared<Vector2>(Vector2{x, y});
auto generator = std::make_shared<ArcGenerator>(position, bullets);
auto behaviour = std::make_shared<Falling>(position, generator);
generator->m_interval = 0.4f;
generator->m_speed = 100;
generator->m_arc = 0.1f;
generator->m_segments = 2;
generator->m_last = true;
generator->m_radius = 4;
if (mirror) {
generator->m_color = Color{30, 80, 170, 255};
generator->m_rotation = -0.6f;
generator->m_angle = 1.f;
}
else {
generator->m_color = Color{30, 170, 80, 255};
generator->m_rotation = 0.6f;
}
Enemy enemy(position, generator, behaviour);
enemy.m_hold = hold;
return enemy;
}
|