aboutsummaryrefslogtreecommitdiffstats
path: root/src/player.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/player.cpp')
-rw-r--r--src/player.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/player.cpp b/src/player.cpp
index 01b8a7c..0e43988 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -215,10 +215,21 @@ void PlayerSystem::receive(const KeyDownEvent &kde)
vec2 PlayerSystem::getPosition(void)
{
- auto& loc = *game::entities.component<Position>(player.id()).get();
+ Position loc;
+ if (player)
+ loc = *game::entities.component<Position>(player.id()).get();
+
return vec2(loc.x, loc.y);
}
+float PlayerSystem::getWidth(void)
+{
+ float width = 0;
+ if (player)
+ width = game::entities.component<Solid>(player.id())->width;
+ return width;
+}
+
void PlayerSystem::receive(const UseItemEvent& uie)
{
static std::atomic_bool cool (true);