summaryrefslogtreecommitdiffhomepage
path: root/Oscillating.cpp
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-04-20 00:28:48 +0200
committerAki <please@ignore.pl>2022-04-20 00:28:48 +0200
commitfd9232b3d3a3aee28a5965a5ebc4077f8db7c652 (patch)
treee9bdb832ed15704f5640ffc9543131f02e6e6e32 /Oscillating.cpp
parent5f0c15b2d3299ea210a78d54e9b10c3cb4266139 (diff)
downloadbullethell2022-fd9232b3d3a3aee28a5965a5ebc4077f8db7c652.zip
bullethell2022-fd9232b3d3a3aee28a5965a5ebc4077f8db7c652.tar.gz
bullethell2022-fd9232b3d3a3aee28a5965a5ebc4077f8db7c652.tar.bz2
Streamlined enemy composition
Diffstat (limited to 'Oscillating.cpp')
-rw-r--r--Oscillating.cpp20
1 files changed, 6 insertions, 14 deletions
diff --git a/Oscillating.cpp b/Oscillating.cpp
index 4839282..eef33df 100644
--- a/Oscillating.cpp
+++ b/Oscillating.cpp
@@ -1,33 +1,25 @@
#include "Oscillating.h"
#include <cmath>
+#include <memory>
#include <raylib.h>
-#include "Generator.h"
-
-Oscillating::Oscillating() :
+Oscillating::Oscillating(std::shared_ptr<Vector2> position) :
m_phase {0},
- m_shift {1.6f}
+ m_shift {1.6f},
+ m_position {position}
{
}
void
-Oscillating::update(const float dt, Vector2& position, Generator& generator)
+Oscillating::update(const float dt)
{
- (void) generator;
m_phase += dt * 0.8f;
if (m_phase > 2.f)
m_phase -= 2.f;
const float cos = std::cos(m_phase * M_PI);
- position.x += cos * m_shift;
-}
-
-
-void
-Oscillating::set_phase(const float phase)
-{
- m_phase = phase;
+ m_position->x += cos * m_shift;
}