forked from University/epr24pr42-ojanssen2
66 lines
2.4 KiB
C++
66 lines
2.4 KiB
C++
#include "Vector2d.h"
|
|
|
|
#ifndef ENTITY_H
|
|
#define ENTITY_H
|
|
|
|
namespace game
|
|
{
|
|
class Maze;
|
|
/// Eine Entität, z.B. ein Geist
|
|
class Entity {
|
|
private:
|
|
/// Die aktuelle Position des Geistes
|
|
Vector2d pos;
|
|
/// Wie der Geist dargestellt werden sollte
|
|
char display_character;
|
|
/// Ist wahr, wenn der Bowie nach Links läuft, falsch, wenn er nach Rechts läuft.
|
|
bool move_left;
|
|
|
|
/// Behandle Bowie Bewegungen
|
|
/// @param maze Das Labyrinth
|
|
void handle_bowie(const Maze& maze);
|
|
|
|
/// Behandle Connelly Bewegungen
|
|
/// @param maze Das Labyrinth
|
|
/// @param player_position Die Position des Spielers
|
|
void handle_connelly(const Maze& maze, const Vector2d& player_position);
|
|
|
|
/// Versuche den Connelly nach oben zu bewegen
|
|
/// @param maze Das Labyrinth
|
|
/// @returns Ob die Bewegung geglückt hat
|
|
bool connelly_move_up(const Maze& maze);
|
|
|
|
/// Versuche den Connelly nach unten zu bewegen
|
|
/// @param maze Das Labyrinth
|
|
/// @returns Ob die Bewegung geglückt hat
|
|
bool connelly_move_down(const Maze& maze);
|
|
|
|
/// Versuche den Connelly nach links zu bewegen
|
|
/// @param maze Das Labyrinth
|
|
/// @returns Ob die Bewegung geglückt hat
|
|
bool connelly_move_left(const Maze& maze);
|
|
|
|
/// Versuche den Connelly nach Rechts zu bewegen
|
|
/// @param maze Das Labyrinth
|
|
/// @returns Ob die Bewegung geglückt hat
|
|
bool connelly_move_right(const Maze& maze);
|
|
public:
|
|
Entity(Vector2d starting_position, char display_character);
|
|
|
|
/// Halte den Entität bzw. den Geist up to date, bewege ihn
|
|
/// @param maze Das Labyrinth
|
|
/// @param player_position Die Position des Spielers
|
|
void tick(const Maze& maze, const Vector2d& player_position);
|
|
|
|
/// Kontrolliere, ob sich das Entity auf einer Position befindet
|
|
/// @param position Die Position
|
|
/// @returns Ob das sich das Entity auf der Position befindet
|
|
bool is_at_position(const Vector2d& position) const;
|
|
|
|
/// Besorge dir das Zeichen, was auf dem Labyrinth angezeigt werden soll
|
|
/// @returns Das Zeichen
|
|
char get_display_character() const;
|
|
};
|
|
} // game
|
|
|
|
#endif //ENTITY_H
|