diff --git a/TrustFall/TrustFall/BigMrManager.bmp b/TrustFall/TrustFall/BigMrManager.bmp
new file mode 100644
index 0000000..f1bbfa8
Binary files /dev/null and b/TrustFall/TrustFall/BigMrManager.bmp differ
diff --git a/TrustFall/TrustFall/TrustFall.vcxproj b/TrustFall/TrustFall/TrustFall.vcxproj
index fc3ad9b..8209fe7 100644
--- a/TrustFall/TrustFall/TrustFall.vcxproj
+++ b/TrustFall/TrustFall/TrustFall.vcxproj
@@ -131,6 +131,7 @@
+
@@ -138,6 +139,7 @@
+
diff --git a/TrustFall/TrustFall/TrustFall.vcxproj.filters b/TrustFall/TrustFall/TrustFall.vcxproj.filters
index b9d8f93..ad87e00 100644
--- a/TrustFall/TrustFall/TrustFall.vcxproj.filters
+++ b/TrustFall/TrustFall/TrustFall.vcxproj.filters
@@ -45,6 +45,9 @@
Source Files\ScreensImplement
+
+ Source Files\ScreensImplement
+
@@ -62,5 +65,8 @@
Header Files\Screens
+
+ Header Files\Screens
+
\ No newline at end of file
diff --git a/TrustFall/TrustFall/catcher.cpp b/TrustFall/TrustFall/catcher.cpp
new file mode 100644
index 0000000..3831755
--- /dev/null
+++ b/TrustFall/TrustFall/catcher.cpp
@@ -0,0 +1,9 @@
+#include "catcher.h"
+
+Catcher::Catcher(int _position) {
+ position = _position;
+}
+
+void Catcher::move_up()
+{
+}
diff --git a/TrustFall/TrustFall/catcher.h b/TrustFall/TrustFall/catcher.h
new file mode 100644
index 0000000..0ad20af
--- /dev/null
+++ b/TrustFall/TrustFall/catcher.h
@@ -0,0 +1,9 @@
+#pragma once
+class Catcher {
+public:
+ int position;
+
+ Catcher(int _position);
+
+ void move_up();
+};
\ No newline at end of file
diff --git a/TrustFall/TrustFall/conveyor.bmp b/TrustFall/TrustFall/conveyor.bmp
new file mode 100644
index 0000000..43cabfc
Binary files /dev/null and b/TrustFall/TrustFall/conveyor.bmp differ
diff --git a/TrustFall/TrustFall/cursor.cpp b/TrustFall/TrustFall/cursor.cpp
index 160d131..e591e93 100644
--- a/TrustFall/TrustFall/cursor.cpp
+++ b/TrustFall/TrustFall/cursor.cpp
@@ -4,6 +4,7 @@
#include
#include "cursor.h"
+#include "line.h"
using std::string;
using std::vector;
@@ -99,4 +100,4 @@ 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/TrustFall/TrustFall/employee.bmp b/TrustFall/TrustFall/employee.bmp
new file mode 100644
index 0000000..f35a8a0
Binary files /dev/null and b/TrustFall/TrustFall/employee.bmp differ
diff --git a/TrustFall/TrustFall/employee.cpp b/TrustFall/TrustFall/employee.cpp
new file mode 100644
index 0000000..69382ae
--- /dev/null
+++ b/TrustFall/TrustFall/employee.cpp
@@ -0,0 +1,11 @@
+#include "employee.h"
+
+Employee::Employee(int _line) {
+ position = 6;
+}
+
+void Employee::move() {
+ position -= 1;
+}
+
+
diff --git a/TrustFall/TrustFall/employee.h b/TrustFall/TrustFall/employee.h
new file mode 100644
index 0000000..90337cc
--- /dev/null
+++ b/TrustFall/TrustFall/employee.h
@@ -0,0 +1,9 @@
+#pragma once
+class Employee {
+public:
+ int position;
+
+ Employee(int _line);
+
+ void move();
+};
\ No newline at end of file
diff --git a/TrustFall/TrustFall/employee_happy.bmp b/TrustFall/TrustFall/employee_happy.bmp
new file mode 100644
index 0000000..61daded
Binary files /dev/null and b/TrustFall/TrustFall/employee_happy.bmp differ
diff --git a/TrustFall/TrustFall/employee_sad.bmp b/TrustFall/TrustFall/employee_sad.bmp
new file mode 100644
index 0000000..9250cea
Binary files /dev/null and b/TrustFall/TrustFall/employee_sad.bmp differ
diff --git a/TrustFall/TrustFall/game.cpp b/TrustFall/TrustFall/game.cpp
index 1c9e89a..368ccc8 100644
--- a/TrustFall/TrustFall/game.cpp
+++ b/TrustFall/TrustFall/game.cpp
@@ -1,5 +1,6 @@
#include "game.h"
#include "start_screen.h"
+#include "game_screen.h"
using std::string;
using std::map;
@@ -13,10 +14,14 @@ void Game::init() {
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("MrManager.bmp")));
+ sprites.insert(pair("Mr. Manager", al_load_bitmap("BigMrManager.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")));
+
font = al_create_builtin_font();
}
@@ -26,13 +31,18 @@ void Game::reset() {
}
void Game::run() {
+ StartScreen start_screen(sprites);
+ GameScreen game_screen(sprites);
while (state != Exit) {
switch (state) {
case Start:
- StartScreen start_screen(sprites);
start_screen.run(font);
state = start_screen.next_state;
break;
+ case Gameplay:
+ game_screen.run(font);
+ state = game_screen.next_state;
+ break;
}
}
}
\ No newline at end of file
diff --git a/TrustFall/TrustFall/game_screen.cpp b/TrustFall/TrustFall/game_screen.cpp
index 59c318e..7ea626b 100644
--- a/TrustFall/TrustFall/game_screen.cpp
+++ b/TrustFall/TrustFall/game_screen.cpp
@@ -6,8 +6,14 @@
using std::vector;
using std::string;
-GameScreen::GameScreen(std::map _sprites) {
+GameScreen::GameScreen(std::map _sprites, int _lines) {
sprites = _sprites;
+
+ for (int i = 0; i < _lines; i++) {
+ Line new_line(SCREEN_W-220, SCREEN_H/_lines * i, sprites);
+ }
+
+ selected = 0;
}
void GameScreen::run(ALLEGRO_FONT * font) {
diff --git a/TrustFall/TrustFall/game_screen.h b/TrustFall/TrustFall/game_screen.h
index ece3708..984fd21 100644
--- a/TrustFall/TrustFall/game_screen.h
+++ b/TrustFall/TrustFall/game_screen.h
@@ -1,12 +1,15 @@
#pragma once
+#include "line.h"
#include "screen.h"
#include "cursor.h"
class GameScreen : public Screen {
public:
std::map sprites;
+ std::vector lines;
+ int selected;
- GameScreen(std::map _sprites);
+ GameScreen(std::map _sprites, int _lines);
void run(ALLEGRO_FONT* font);
void redraw(ALLEGRO_FONT* font);
diff --git a/TrustFall/TrustFall/line.cpp b/TrustFall/TrustFall/line.cpp
new file mode 100644
index 0000000..ac88528
--- /dev/null
+++ b/TrustFall/TrustFall/line.cpp
@@ -0,0 +1,89 @@
+#include "line.h"
+
+using std::map;
+using std::string;
+
+Line::Line(int _start_x, int _start_y, map _sprites) {
+ start_x = _start_x;
+ start_y = _start_y;
+
+ sprites = _sprites;
+
+ queued = false;
+ fall = false;
+
+ for (int i = 0; i < 3; i++) {
+ catchers[i] = 0;
+ }
+ for (int i = 0; i < 5; i++) {
+ employees[i] = 0;
+ }
+}
+
+void Line::move() {
+ if (caught) {
+ caught = false;
+ catchers[0] = catchers[1];
+ catchers[1] = catchers[0];
+ catchers[2] = 0;
+ }
+
+ if (employees[0]) {
+ if (catchers[0]) {
+ caught = true;
+ }
+ else {
+ fall = true;
+ }
+ }
+ for (int i = 0; i < 4; i++) {
+ employees[i] = employees[i + 1];
+ }
+ employees[4] = (queued) ? 1 : 0;
+ queued = false;
+}
+
+void Line::add_employee() {
+ queued = true;
+}
+
+void Line::add_catcher() {
+ for (int i = 2; i > -1; i--) {
+ if (!catchers[i]) {
+ catchers[i] = 1;
+ break;
+ }
+ }
+}
+
+void Line::draw() {
+ al_draw_bitmap(sprites["Conveyor"], start_x, start_y, NULL);
+
+ for (int i = 0; i < 5; i++) {
+ if (employees[i]) {
+ al_draw_bitmap(sprites["Employee"], start_x + (40 * i), start_y, NULL);
+ }
+ }
+
+ for (int i = 2; i > -1; i++) {
+ if (i = 0) {
+ if (caught) {
+ al_draw_bitmap(sprites["EmployeeHappy"], start_x - 40, start_y, NULL);
+ al_draw_bitmap(sprites["MrMan"], start_x - 40, start_y - 40, NULL);
+ }
+ else if (fall) {
+ al_draw_bitmap(sprites["EmployeeSad"], start_x - 40, start_y - 55, ALLEGRO_FLIP_VERTICAL);
+ }
+ else {
+ if (catchers[i]) {
+ al_draw_bitmap(sprites["MrMan"], start_x - 40, start_y - 40, NULL);
+ }
+ }
+ }
+ else {
+ if (catchers[i]) {
+ al_draw_bitmap(sprites["MrMan"], start_x - 40 - (50*(i+1)), start_y - 40, NULL);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/TrustFall/TrustFall/line.h b/TrustFall/TrustFall/line.h
new file mode 100644
index 0000000..ab9c6f0
--- /dev/null
+++ b/TrustFall/TrustFall/line.h
@@ -0,0 +1,30 @@
+#pragma once
+#include
+#include
+#include