Merge branch 'feature/game_logic/collisionFix' into feature/game_logic/game_over

* feature/game_logic/collisionFix:
  [FIXED] collisions
  [WIP] collision fixing

# Conflicts:
#	src/scenes/game_Over_Scene.cpp
#	src/scenes/in_Game_Scene.cpp
This commit is contained in:
DESKTOP-EBR7IVA\kimve
2021-06-18 13:57:34 +02:00
12 changed files with 78 additions and 80 deletions

View File

@@ -193,7 +193,7 @@ namespace scene
{
if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_PRESS)
{
return_value = scene::Scenes::STARTUP;
//return_value = scene::Scenes::STARTUP;
cv::destroyWindow("camera");
}
else if (glfwGetKey(window, GLFW_KEY_BACKSPACE) == GLFW_PRESS) {

View File

@@ -129,14 +129,16 @@ namespace scene
for (int i = 0; i < furniture_count; i++)
{
house_models.pop_front();
collision_entities.pop_back();
}
}
int z_offset = model_pos * (house_generator->GetHouseDepth()); // how much "in the distance" we should load the model
std::deque<std::shared_ptr<entities::Entity>> furniture = house_generator->GenerateHouse(glm::vec3(0, -75, -50 - z_offset), 90);
std::deque<std::shared_ptr<entities::CollisionEntity>> furniture = house_generator->GenerateHouse(glm::vec3(0, -75, -50 - z_offset), 90);
furniture_count = furniture.size();
house_models.insert(house_models.end(), furniture.begin(), furniture.end());
collision_entities.insert(collision_entities.end(), furniture.begin(), furniture.end());
std::cout << "funriture_count in load chunk (house included): " << furniture_count << std::endl;
furniture_count_old = furniture_count - 1;
@@ -155,7 +157,7 @@ namespace scene
raw_model_char = render_engine::LoadObjModel("res/beeTwo.obj");
models::TexturedModel model_char = { raw_model_char, texture };
collision::Box char_box = create_bounding_box(raw_model_char.model_size, glm::vec3(0, 0, 0), 1);
main_character = std::make_shared<entities::MainCharacter>(model_char, glm::vec3(0, -50, -100), glm::vec3(0, 90, 0), 5, char_box);
main_character = std::make_shared<entities::MainCharacter>(model_char, glm::vec3(0, 50, -100), glm::vec3(0, 90, 0), 5, char_box);
collision_entities.push_back(main_character);
house_generator = new entities::HouseGenerator();
// load the first few house models

View File

@@ -20,7 +20,6 @@ namespace scene {
class Scene
{
static int END_SCORE;
public:
virtual ~Scene() = 0;
@@ -55,13 +54,6 @@ namespace scene {
* @return void
*/
virtual void onKey(GLFWwindow* window, int key, int scancode, int action, int mods) {};
static void SetEndScore(int score) {
END_SCORE = score;
}
static int GetEndScore() {
return END_SCORE;
}
};
}

View File

@@ -211,7 +211,7 @@ namespace scene
{
if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_PRESS)
{
return_value = scene::Scenes::GAMEOVER;
return_value = scene::Scenes::INGAME;
cv::destroyWindow("camera");
}
else if (glfwGetKey(window, GLFW_KEY_BACKSPACE) == GLFW_PRESS) {