From 644d59114df15a6156be60af6635a3cb1cfe1323 Mon Sep 17 00:00:00 2001 From: Adrian Smaka <adrsm067@student.liu.se> Date: Wed, 6 Mar 2024 19:08:14 +0000 Subject: [PATCH] Adrian push --- Uppgift-3-Spel/ghost.cc | 51 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Uppgift-3-Spel/ghost.cc diff --git a/Uppgift-3-Spel/ghost.cc b/Uppgift-3-Spel/ghost.cc new file mode 100644 index 0000000..703cecd --- /dev/null +++ b/Uppgift-3-Spel/ghost.cc @@ -0,0 +1,51 @@ +#include "ghost.h" + +Ghost::Ghost(const string &colorName, Point const &start_position) + : color_index(colorName), pos(start_position) + {} + +void Ghost::set_pos( Point &new_pos) { + pos = new_pos; +} + +Point Ghost::get_pos() { + return pos; +} + +bool Blinky::get_angry(){ + return angry; +} + +void Blinky::set_angry(bool state) { + angry = state; +} + +Blinky::Blinky(std::string const &color, Point const &start_pos) + : Ghost("red", start_pos) + {} + +void Blinky::set_pos(Point &new_pos) { + set_pos(new_pos); +} + +Point Blinky::get_scatter(const Point &pos_pacman) { + if (angry == true) + { + return Point{pos_pacman.x, pos_pacman.y}; // stämmer? + } else + { + return Point{6, 6}; + } +} + +Point Blinky::get_chase(const Point &pos_pacman, const Point &dir_pacman) { + return Point{pos_pacman.x, pos_pacman.y}; +} + +Point Blinky::get_pos() { + return pos; +} + +std::string Blinky::get_color() { + return "pink"; +} \ No newline at end of file -- GitLab