From 12ffc7333a64bac090f24e5620d3ce27ddb38ec3 Mon Sep 17 00:00:00 2001 From: Braydon Kains Date: Thu, 24 Jan 2019 15:25:44 -0500 Subject: [PATCH] shit is bugged trying to do hit detection --- Assignment3Project/Assignment3Project/game_screen.cpp | 8 ++++++-- Assignment3Project/Assignment3Project/ship.cpp | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Assignment3Project/Assignment3Project/game_screen.cpp b/Assignment3Project/Assignment3Project/game_screen.cpp index 3529929..023f1a3 100644 --- a/Assignment3Project/Assignment3Project/game_screen.cpp +++ b/Assignment3Project/Assignment3Project/game_screen.cpp @@ -162,7 +162,7 @@ void GameScreen::run(ALLEGRO_FONT* font) { map_y -= 10; } else { - next_state = Exit; + exit_screen = true; } if (more_enemies && map_y >= next_enemy.when) { @@ -180,6 +180,10 @@ void GameScreen::run(ALLEGRO_FONT* font) { } //Global refresh + if (objects.chk_player_col()) { + exit_screen = true; + } + score += objects.chk_bullet_col(); objects.move_enemies(); al_clear_to_color(al_map_rgb(0, 0, 0)); redraw(font); @@ -281,5 +285,5 @@ void GameScreen::back() { } void GameScreen::cont() { - next_state = End; + next_state = Start; } \ No newline at end of file diff --git a/Assignment3Project/Assignment3Project/ship.cpp b/Assignment3Project/Assignment3Project/ship.cpp index 1810c3e..80861b0 100644 --- a/Assignment3Project/Assignment3Project/ship.cpp +++ b/Assignment3Project/Assignment3Project/ship.cpp @@ -3,7 +3,7 @@ Ship::Ship(Behavior _behavior) { switch (_behavior) { case Enemy: - speed = 1.2; + speed = 0.5; height = 40; width = 40; @@ -12,7 +12,7 @@ Ship::Ship(Behavior _behavior) { h_bound = SCREEN_H; break; default: - speed = 0.5; + speed = 1.0; height = 40; width = 40;