-
Notifications
You must be signed in to change notification settings - Fork 0
/
entity.hpp
65 lines (50 loc) · 1.4 KB
/
entity.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#pragma once
#include <iostream>
#include <array>
#include <string>
#include "math_functions.hpp"
#include "constants.hpp"
class Entity {
protected:
std::string name;
sf::Vector2f position;
sf::Vector2f movement;
sf::Color color;
const float angle = 0.07f;
sf::CircleShape circle;
bool alive = true;
std::array<sf::Vector2f, 4> last_steps;
unsigned int score{ 0 };
public:
Entity(){}
Entity(const Entity& other);
Entity& operator= (const Entity& other);
Entity(Entity&& other);
Entity& operator= (Entity&& other);
public:
// collision and movement
virtual void move() {}
const bool isAlive() const;
void update_last_steps();
virtual bool collision_check();
virtual void collision() {}
public:
//getters and setters
void setPosition(sf::Vector2f&& position);
void setPosition(const sf::Vector2f& position);
virtual void init_position() {};
const sf::Vector2f& getPosition() const;
// ^~~~~ the function will not change what it gives
const sf::CircleShape& get_circle() const;
// the funtion will not change the obj ~~~~^
const std::array<sf::Vector2f, 4>& get_last_steps() const;
void set_movement(const sf::Vector2f& v);
void init_movement();
std::string get_name();
const sf::Color get_color() const;
void set_score(const unsigned int& score);
void inc_score();
unsigned int get_score();
void raise();
void kill();
};