diff options
author | Aki <please@ignore.pl> | 2022-04-18 10:25:21 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-04-18 10:25:21 +0200 |
commit | 8209bbaf2a046199b9c65438fb4454ce01b42500 (patch) | |
tree | 7bddc234a27afe9e6443b41999edcf4fef56b74b /Player.cpp | |
parent | 162ab6e923cf0c065449cfc248102b5b92fac8a7 (diff) | |
download | bullethell2022-8209bbaf2a046199b9c65438fb4454ce01b42500.zip bullethell2022-8209bbaf2a046199b9c65438fb4454ce01b42500.tar.gz bullethell2022-8209bbaf2a046199b9c65438fb4454ce01b42500.tar.bz2 |
Exported player to own class
Diffstat (limited to 'Player.cpp')
-rw-r--r-- | Player.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Player.cpp b/Player.cpp new file mode 100644 index 0000000..736f96a --- /dev/null +++ b/Player.cpp @@ -0,0 +1,26 @@ +#include "Player.h" + +#include <raylib.h> + + +Player::Player() : + m_position {400, 450} +{ +} + + +void +Player::update(const float dt) +{ + if (IsKeyDown(KEY_LEFT)) + m_position.x -= dt * 80; + if (IsKeyDown(KEY_RIGHT)) + m_position.x += dt * 80; +} + + +void +Player::draw() +{ + DrawCircle(m_position.x, m_position.y, 10, LIGHTGRAY); +} |