diff --git a/games/VentureAdventure/.vscode/.BROWSE.VC.DB b/games/VentureAdventure/.vscode/.BROWSE.VC.DB index 3716d9a0..1b956b58 100644 Binary files a/games/VentureAdventure/.vscode/.BROWSE.VC.DB and b/games/VentureAdventure/.vscode/.BROWSE.VC.DB differ diff --git a/games/VentureAdventure/.vscode/.BROWSE.VC.DB-shm b/games/VentureAdventure/.vscode/.BROWSE.VC.DB-shm index 95539cc9..4d1b3101 100644 Binary files a/games/VentureAdventure/.vscode/.BROWSE.VC.DB-shm and b/games/VentureAdventure/.vscode/.BROWSE.VC.DB-shm differ diff --git a/games/VentureAdventure/game.cpp b/games/VentureAdventure/game.cpp index b5e6bf38..ef6b5413 100644 --- a/games/VentureAdventure/game.cpp +++ b/games/VentureAdventure/game.cpp @@ -78,7 +78,8 @@ void get_objects(game_data &game) for (int i = 0; i < w; i++) for (int j = 0; j < h; j++) { - if(game.map_array[i][j] > 1 && game.map_array[i][j] < 300) + //tiles with numbers defined between 1 and 300 are 'solid'. Excludes 'enemy' currently defines as 200 (so that collision is possible. This if statement needs to be adjusted if more enemy tile numbers are added) + if(game.map_array[i][j] > 1 && game.map_array[i][j] < 300 && game.map_array[i][j] != 200) { int solid_x = j*TILESIZE; int solid_y = i*TILESIZE; @@ -222,6 +223,7 @@ void swap(gem_data g1, gem_data g2) g2 = temp; } + void gem_collision(game_data &game) { for (int i = 0; i < game.gems.size(); i++) @@ -233,6 +235,18 @@ void gem_collision(game_data &game) } } +//adding a first collision check between player and enemy +void enemy_collision(game_data &game) +{ + for (int i = 0; i < game.enemies.size(); i++) + if(sprite_collision(game.player.player_sprite, game.enemies[i].enemy_sprite)) + { + play_sound_effect("diamond"); + //game.player.gem += 1; + //remove_gem(game, i); + } +} + void attack(game_data &game) { int box_id; @@ -441,6 +455,8 @@ void moving(game_data &game) // collect gem gem_collision(game); + enemy_collision(game); + if(game.player.y_prev > game.player.y_pos && game.player.y_pos <= game.player.next) { sprite_start_animation(game.player.player_sprite, "stand_u"); diff --git a/games/VentureAdventure/game.exe b/games/VentureAdventure/game.exe index 8e572f8e..8708188b 100644 Binary files a/games/VentureAdventure/game.exe and b/games/VentureAdventure/game.exe differ diff --git a/games/VentureAdventure/program.cpp b/games/VentureAdventure/program.cpp index 2bdff06f..174d18a3 100644 --- a/games/VentureAdventure/program.cpp +++ b/games/VentureAdventure/program.cpp @@ -57,7 +57,7 @@ int main() game = new_game(map); } - start_debug(game); + //start_debug(game); refresh_screen(60);