summaryrefslogtreecommitdiffhomepage
path: root/Falling.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 /Falling.cpp
parent5f0c15b2d3299ea210a78d54e9b10c3cb4266139 (diff)
downloadbullethell2022-fd9232b3d3a3aee28a5965a5ebc4077f8db7c652.zip
bullethell2022-fd9232b3d3a3aee28a5965a5ebc4077f8db7c652.tar.gz
bullethell2022-fd9232b3d3a3aee28a5965a5ebc4077f8db7c652.tar.bz2
Streamlined enemy composition
Diffstat (limited to 'Falling.cpp')
-rw-r--r--Falling.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/Falling.cpp b/Falling.cpp
index deb81a4..38c05d4 100644
--- a/Falling.cpp
+++ b/Falling.cpp
@@ -1,20 +1,24 @@
#include "Falling.h"
+#include <memory>
+
#include <raylib.h>
#include "Generator.h"
-Falling::Falling() :
- m_speed {40}
+Falling::Falling(std::shared_ptr<Vector2> position, std::shared_ptr<Generator> generator) :
+ m_speed {40},
+ m_position {position},
+ m_generator {generator}
{
}
void
-Falling::update(const float dt, Vector2& position, Generator& generator)
+Falling::update(const float dt)
{
- position.y += dt * m_speed;
- if (position.y > 600)
- generator.toggle(false);
+ m_position->y += dt * m_speed;
+ if (m_generator->m_enabled && m_position->y > 620)
+ m_generator->m_enabled = false;
}