From 25225708c1164f9662a45444e2c2c5e526b37cb4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nils=20Forss=C3=A9n?= Date: Thu, 9 Nov 2023 15:51:54 +0100 Subject: [PATCH] Added player --- src/Moving_object.h | 12 ++++++++++++ src/Object.h | 7 ++++++- src/Player.h | 21 +++++++++++++++------ 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/src/Moving_object.h b/src/Moving_object.h index e69de29..df01e7f 100644 --- a/src/Moving_object.h +++ b/src/Moving_object.h @@ -0,0 +1,12 @@ +#ifndef MOVING_OBJECTS_H +#define MOVING_OBJECTS_H + +#include "Object.h" + +class Moving_object : Object +{ +public: +protected: +private: +}; +#endif \ No newline at end of file diff --git a/src/Object.h b/src/Object.h index 5fb3021..dd5ed78 100644 --- a/src/Object.h +++ b/src/Object.h @@ -1,3 +1,6 @@ +#ifndef OBJECT_H +#define OBJECT_H + #include #include @@ -15,4 +18,6 @@ protected: double x_pos; double y_pos; sf::Sprite sprite; -}; \ No newline at end of file +}; + +#endif \ No newline at end of file diff --git a/src/Player.h b/src/Player.h index af6e1dc..de9d49b 100644 --- a/src/Player.h +++ b/src/Player.h @@ -1,11 +1,20 @@ +#include +#include "Moving_object.h" #include "Object.h" -class Player::Object -{ - - - +class Player : Moving_object +{ +public: + Player(); + ~Player(); + bool collides(Object& other); + void collision(Object& other); + void update(); + void render(sf::RenderWindow& window); -} \ No newline at end of file +protected: +private: + int collected; +}; \ No newline at end of file -- 2.30.2