diff --git a/Assignment3Project/Assignment3Project.sln b/Assignment3Project/Assignment3Project.sln
new file mode 100644
index 0000000..d8f531f
--- /dev/null
+++ b/Assignment3Project/Assignment3Project.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.28010.2050
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Assignment3Project", "Assignment3Project\Assignment3Project.vcxproj", "{8A067FEB-7D3A-45FB-BED3-77A1965E41D8}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {8A067FEB-7D3A-45FB-BED3-77A1965E41D8}.Debug|x64.ActiveCfg = Debug|x64
+ {8A067FEB-7D3A-45FB-BED3-77A1965E41D8}.Debug|x64.Build.0 = Debug|x64
+ {8A067FEB-7D3A-45FB-BED3-77A1965E41D8}.Debug|x86.ActiveCfg = Debug|Win32
+ {8A067FEB-7D3A-45FB-BED3-77A1965E41D8}.Debug|x86.Build.0 = Debug|Win32
+ {8A067FEB-7D3A-45FB-BED3-77A1965E41D8}.Release|x64.ActiveCfg = Release|x64
+ {8A067FEB-7D3A-45FB-BED3-77A1965E41D8}.Release|x64.Build.0 = Release|x64
+ {8A067FEB-7D3A-45FB-BED3-77A1965E41D8}.Release|x86.ActiveCfg = Release|Win32
+ {8A067FEB-7D3A-45FB-BED3-77A1965E41D8}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {31EA9156-58D8-4051-BF47-8493A2F999B2}
+ EndGlobalSection
+EndGlobal
diff --git a/Assignment3Project/Assignment3Project/Assignment3Project.vcxproj b/Assignment3Project/Assignment3Project/Assignment3Project.vcxproj
new file mode 100644
index 0000000..eb85e82
--- /dev/null
+++ b/Assignment3Project/Assignment3Project/Assignment3Project.vcxproj
@@ -0,0 +1,155 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 15.0
+ {8A067FEB-7D3A-45FB-BED3-77A1965E41D8}
+ Assignment3Project
+ 10.0.17134.0
+
+
+
+ Application
+ true
+ v141
+ MultiByte
+
+
+ Application
+ false
+ v141
+ true
+ MultiByte
+
+
+ Application
+ true
+ v141
+ MultiByte
+
+
+ Application
+ false
+ v141
+ true
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+
+
+
+ Level3
+ Disabled
+ true
+ true
+
+
+
+
+ Level3
+ Disabled
+ true
+ true
+
+
+
+
+ Level3
+ MaxSpeed
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+
+
+
+
+ Level3
+ MaxSpeed
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+
+
+
\ No newline at end of file
diff --git a/Assignment3Project/Assignment3Project/Assignment3Project.vcxproj.filters b/Assignment3Project/Assignment3Project/Assignment3Project.vcxproj.filters
new file mode 100644
index 0000000..5bbc6d0
--- /dev/null
+++ b/Assignment3Project/Assignment3Project/Assignment3Project.vcxproj.filters
@@ -0,0 +1,75 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;hm;inl;inc;ipp;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+ {b3cfe90b-396f-4928-8b95-6b453c9cdee6}
+
+
+ {079f6f25-ed43-4671-bb66-1a1c580b5f6b}
+
+
+ {e9904f71-fa80-4ab4-a0ee-7fc1c8c3f92e}
+
+
+ {60b0cc02-34f3-4b2f-a55d-aae1f622f730}
+
+
+ {df34ca78-eaef-42da-84e1-e081ee065499}
+
+
+ {d177d104-1e60-4cd4-81d4-232c379ac302}
+
+
+
+
+ Header Files\Engine
+
+
+ Header Files\Engine
+
+
+ Header Files\Screens
+
+
+ Header Files\Engine
+
+
+ Header Files\Assignment3
+
+
+ Header Files\Screens
+
+
+
+
+ Source Files
+
+
+ Source Files\ScreensImplement
+
+
+ Source Files\EngineImplement
+
+
+ Source Files\EngineImplement
+
+
+ Source Files\ScreensImplement
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Assignment3Project/Assignment3Project/cursor.cpp b/Assignment3Project/Assignment3Project/cursor.cpp
new file mode 100644
index 0000000..9d6620f
--- /dev/null
+++ b/Assignment3Project/Assignment3Project/cursor.cpp
@@ -0,0 +1,109 @@
+#include
+#include
+#include
+#include
+
+#include "cursor.h"
+
+using std::string;
+using std::vector;
+
+template
+Cursor::Cursor()
+{
+ active = false;
+}
+
+//Give items to the cursor, and set the selected item to be the first
+template
+void Cursor::activate(std::vector _items)
+{
+ items = _items;
+ selected = 0;
+ active = true;
+}
+
+//Functionality that was not used for this game, may be used in future projects.
+template
+void Cursor::deactivate()
+{
+ active = false;
+}
+
+//Draw the menu options on the screen based on the x and y coordinates for the menu to start at
+template
+void Cursor::draw(float _x_start, float _y_start, float _y_offset, ALLEGRO_FONT* _font) {
+ vector items_text = get_item_strings();
+
+ x_start = _x_start;
+ y_start = _y_start;
+ y_offset = _y_offset;
+ font = _font;
+
+ for (unsigned int i = 0; i < items_text.size(); i++) {
+ al_draw_text(font, al_map_rgb(255, 255, 255), x_start, y_start + (y_offset*i), ALLEGRO_ALIGN_LEFT, items_text.at(i).c_str());
+ }
+
+ update_selector();
+}
+
+//Change the selection of the cursor
+template
+void Cursor::down()
+{
+ if (selected < items.size() - 1) {
+ selected++;
+ redraw();
+ }
+}
+
+template
+void Cursor::up()
+{
+ if (selected > 0) {
+ selected--;
+ redraw();
+ }
+}
+
+template
+T Cursor::get_selected() {
+ return items.at(selected);
+}
+
+//Clear screen before drawing menu
+template
+void Cursor::redraw()
+{
+ al_clear_to_color(al_map_rgb(0, 0, 0));
+ draw(x_start, y_start, y_offset, font);
+}
+
+//Draw selector to highlight proper selected item
+template
+void Cursor::update_selector() {
+ ALLEGRO_COLOR white = al_map_rgb(255, 255, 255);
+ float offset = y_offset * selected;
+ float x1 = x_start - 5;
+ float y1 = y_start + offset;
+ float x2 = x_start - 5;
+ float y2 = y_start + 5 + offset;
+ float x3 = x_start - 1;
+ float y3 = y_start + 2.5 + offset;
+
+ al_draw_filled_triangle(x1, y1, x2, y2, x3, y3, white);
+}
+
+//Define how the template will function when given various types. Only string was needed for this project.
+template Cursor::Cursor();
+template void Cursor::activate(std::vector _options);
+template void Cursor::deactivate();
+template void Cursor::draw(float x_start, float y_start, float _y_offset, ALLEGRO_FONT* font);
+template void Cursor::redraw();
+template void Cursor::up();
+template void Cursor::down();
+template string Cursor::get_selected();
+template void Cursor::update_selector();
+vector Cursor::get_item_strings() {
+ return items;
+}
\ No newline at end of file
diff --git a/Assignment3Project/Assignment3Project/cursor.h b/Assignment3Project/Assignment3Project/cursor.h
new file mode 100644
index 0000000..98df0d7
--- /dev/null
+++ b/Assignment3Project/Assignment3Project/cursor.h
@@ -0,0 +1,32 @@
+#pragma once
+#include
+#include
+#include
+
+//Default object used for menues
+template
+class Cursor {
+public:
+ std::vector items;
+ unsigned int selected;
+ bool active;
+
+ Cursor();
+
+ void activate(std::vector _items);
+ void deactivate();
+ void draw(float _x_start, float _y_start, float _y_offset, ALLEGRO_FONT* _font);
+ void up();
+ void down();
+ T get_selected();
+
+private:
+ float x_start;
+ float y_start;
+ float y_offset;
+ ALLEGRO_FONT* font;
+
+ std::vector get_item_strings();
+ void update_selector();
+ void redraw();
+};
\ No newline at end of file
diff --git a/Assignment3Project/Assignment3Project/enums.h b/Assignment3Project/Assignment3Project/enums.h
new file mode 100644
index 0000000..9ec40eb
--- /dev/null
+++ b/Assignment3Project/Assignment3Project/enums.h
@@ -0,0 +1,8 @@
+#pragma once
+
+enum State {
+ Start,
+ Gameplay,
+ End,
+ Exit
+};
\ No newline at end of file
diff --git a/Assignment3Project/Assignment3Project/game.cpp b/Assignment3Project/Assignment3Project/game.cpp
new file mode 100644
index 0000000..ce9d1eb
--- /dev/null
+++ b/Assignment3Project/Assignment3Project/game.cpp
@@ -0,0 +1,113 @@
+#include "game.h"
+#include "start_screen.h"
+#include "game_screen.h"
+#include "result_screen.h"
+
+using std::string;
+using std::map;
+using std::pair;
+
+Game::Game() {
+}
+
+//Load all global data for the game: sprites, audio, and font.
+void Game::init() {
+ score = 0;
+ state = Start;
+ sprites.insert(pair("Title", al_load_bitmap("logo.bmp")));
+ sprites.insert(pair("Mr. Man", al_load_bitmap("MrMan.bmp")));
+ sprites.insert(pair("Mr. Manager", al_load_bitmap("BigMrManager.bmp")));
+ sprites.insert(pair("Mr. ManagerSad", al_load_bitmap("mrmanagersad.bmp")));
+ sprites.insert(pair("Mr. ManagerHappy", al_load_bitmap("mrmanagerhappy.bmp")));
+ sprites.insert(pair("KeyUp", al_load_bitmap("small_key_up.bmp")));
+ sprites.insert(pair("Spacebar", al_load_bitmap("spacebar.bmp")));
+ sprites.insert(pair("Employee", al_load_bitmap("employee.bmp")));
+ sprites.insert(pair("EmployeeHappy", al_load_bitmap("employee_happy.bmp")));
+ sprites.insert(pair("EmployeeSad", al_load_bitmap("employee_sad.bmp")));
+ sprites.insert(pair("Conveyor", al_load_bitmap("conveyor.bmp")));
+ sprites.insert(pair("KeyCtrl", al_load_bitmap("small_key_ctrl.bmp")));
+ sprites.insert(pair("KeyH", al_load_bitmap("small_key_h.bmp")));
+ sprites.insert(pair("KeyM", al_load_bitmap("small_key_m.bmp")));
+ sprites.insert(pair("KeyEsc", al_load_bitmap("small_key_esc.bmp")));
+ sprites.insert(pair("MusicOn", al_load_bitmap("music_on.bmp")));
+ sprites.insert(pair("MusicOff", al_load_bitmap("music_off.bmp")));
+
+ al_reserve_samples(4);
+ samples.insert(pair("Theme", al_load_sample("rasputin.wav")));
+ samples.insert(pair("Move", al_load_sample("move.wav")));
+ samples.insert(pair("Catch", al_load_sample("catch.wav")));
+ samples.insert(pair("Fall", al_load_sample("fall.wav")));
+ samples.insert(pair("Place", al_load_sample("place.wav")));
+ samples.insert(pair("LevelUp", al_load_sample("level.wav")));
+
+ font = al_create_builtin_font();
+}
+
+//Was not used in this project
+void Game::reset() {
+}
+
+//Run the game state machine
+void Game::run() {
+ //Load screens
+
+ int difficulty = 1; //Difficulty to run
+ bool EXTREME_ON = false; //Flag for EXTREME easter egg
+ while (state != Exit) {
+ al_clear_to_color(al_map_rgb(0, 0, 0));
+ switch (state) {
+ case Start:
+ start_screen.run(font);
+ if (start_screen.next_state == EXTREME) {
+ EXTREME_ON = true;
+ state = Hard;
+ }
+ else {
+ state = start_screen.next_state;
+ }
+ break;
+ //The same set of code will be run for any difficulty state
+ case Easy:
+ case Medium:
+ case Hard:
+ //But we need to check once here whether the difficulty value needs to be adjusted
+ switch (state) {
+ case Medium:
+ difficulty = 3;
+ result_screen.prev_state = Medium;
+ break;
+ case Hard:
+ difficulty = 5;
+ result_screen.prev_state = Hard;
+ break;
+ }
+ if (EXTREME_ON) {
+ game_screen.reset(5, 5, difficulty); //If the EXTREME easter egg is enabled, the game will be run with 5 lines on hard mode
+ }
+ else {
+ game_screen.reset(3, 5, difficulty);
+ }
+ EXTREME_ON = false;
+ game_screen.run(font);
+ state = game_screen.next_state;
+ break;
+ case End:
+ //Send proper finishing values for this game to the result screen
+ result_screen.score = game_screen.score;
+ result_screen.difficulty = game_screen.difficulty;
+ result_screen.run(font);
+ state = result_screen.next_state;
+ break;
+ }
+ }
+
+ //Garbage collection
+ map::iterator it;
+ for (it = sprites.begin(); it != sprites.end(); it++) {
+ al_destroy_bitmap(it->second);
+ }
+ map::iterator it2;
+ for (it2 = samples.begin(); it2 != samples.end(); it2++) {
+ al_destroy_sample(it2->second);
+ }
+}
\ No newline at end of file
diff --git a/Assignment3Project/Assignment3Project/game.h b/Assignment3Project/Assignment3Project/game.h
new file mode 100644
index 0000000..7e37d30
--- /dev/null
+++ b/Assignment3Project/Assignment3Project/game.h
@@ -0,0 +1,36 @@
+#pragma once
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include