From 2d8714ed2641bc1076e24885e3336da915e6b55d Mon Sep 17 00:00:00 2001 From: BraydonKains Date: Tue, 22 Jan 2019 19:50:57 -0500 Subject: [PATCH] Started implementing behaviors --- .../Assignment3Project.vcxproj | 1 - .../Assignment3Project.vcxproj.filters | 5 +---- .../Assignment3Project/behavior_manager.h | 3 --- Assignment3Project/Assignment3Project/enums.h | 5 +++++ .../Assignment3Project/ship.cpp | 19 ++++++++++++++----- Assignment3Project/Assignment3Project/ship.h | 4 +++- 6 files changed, 23 insertions(+), 14 deletions(-) delete mode 100644 Assignment3Project/Assignment3Project/behavior_manager.h diff --git a/Assignment3Project/Assignment3Project/Assignment3Project.vcxproj b/Assignment3Project/Assignment3Project/Assignment3Project.vcxproj index 3f52e4d..2505e79 100644 --- a/Assignment3Project/Assignment3Project/Assignment3Project.vcxproj +++ b/Assignment3Project/Assignment3Project/Assignment3Project.vcxproj @@ -135,7 +135,6 @@ - diff --git a/Assignment3Project/Assignment3Project/Assignment3Project.vcxproj.filters b/Assignment3Project/Assignment3Project/Assignment3Project.vcxproj.filters index 86362dc..943c9ba 100644 --- a/Assignment3Project/Assignment3Project/Assignment3Project.vcxproj.filters +++ b/Assignment3Project/Assignment3Project/Assignment3Project.vcxproj.filters @@ -63,9 +63,6 @@ Header Files\Engine - - Header Files\Engine - @@ -90,7 +87,7 @@ Source Files\Assignment3Implement - Source Files + Source Files\EngineImplement diff --git a/Assignment3Project/Assignment3Project/behavior_manager.h b/Assignment3Project/Assignment3Project/behavior_manager.h deleted file mode 100644 index 7102054..0000000 --- a/Assignment3Project/Assignment3Project/behavior_manager.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -#include "enums.h" \ No newline at end of file diff --git a/Assignment3Project/Assignment3Project/enums.h b/Assignment3Project/Assignment3Project/enums.h index 7cbc7cc..8cbc602 100644 --- a/Assignment3Project/Assignment3Project/enums.h +++ b/Assignment3Project/Assignment3Project/enums.h @@ -19,4 +19,9 @@ enum Direction { UL, DR, DL +}; + +enum Behavior { + Player, + Enemy }; \ No newline at end of file diff --git a/Assignment3Project/Assignment3Project/ship.cpp b/Assignment3Project/Assignment3Project/ship.cpp index 5b792f3..4e564af 100644 --- a/Assignment3Project/Assignment3Project/ship.cpp +++ b/Assignment3Project/Assignment3Project/ship.cpp @@ -1,10 +1,19 @@ #include "ship.h" -Ship::Ship() { - speed = 1.0; - height = 40; - width = 40; - +Ship::Ship(Behavior _behavior) { + switch (_behavior) { + case Player: + speed = 1.0; + height = 40; + width = 40; + break; + case Enemy: + speed = 1.2; + height = 40; + width = 40; + break; + } + l_bound = 50; r_bound = 590; r_bound -= width; diff --git a/Assignment3Project/Assignment3Project/ship.h b/Assignment3Project/Assignment3Project/ship.h index b034963..5b16220 100644 --- a/Assignment3Project/Assignment3Project/ship.h +++ b/Assignment3Project/Assignment3Project/ship.h @@ -13,7 +13,9 @@ public: float l_bound; float r_bound; - Ship(); + Behavior behavior; + + Ship(Behavior _behavior); void reset_pos(float x, float y); void set_sprite(ALLEGRO_BITMAP* _sprite);