diff options
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); +} |