From 993f3b5b30030ff462506faa7f86a561f1194a02 Mon Sep 17 00:00:00 2001 From: Seth Date: Wed, 23 Oct 2024 16:24:18 -0700 Subject: [PATCH] Minor revision to target layout --- helpers.cpp | 1 + main.cpp | 42 +++++++++++++++++++++--------------------- turret.h | 2 +- 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/helpers.cpp b/helpers.cpp index 36c5882..ef177f9 100644 --- a/helpers.cpp +++ b/helpers.cpp @@ -118,6 +118,7 @@ unsigned int load_texture(const char* filename){ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, image_data); free(image_data); + printf(YELLOW("Generated texture with ID %d\n").c_str(), tex); return tex; } else { printf(RED("Image failed to load: %s\n").c_str(), filename); diff --git a/main.cpp b/main.cpp index 031841a..f0c1e90 100644 --- a/main.cpp +++ b/main.cpp @@ -300,25 +300,21 @@ int main(int argc, char** argv) { glfwSetMouseButtonCallback(window, mouse_click_callback); /* Set starting point */ - player_position = glm::vec3(53, 10, 50); + player_position = glm::vec3(0, 10, 450); player_heading = M_PI; /* Level Loading (hardcoded at the moment) */ - /* + tile_floor fl; objects.push_back(&ice_balls); objects.push_back(&fl); targets.scale = 10.0f; - for(int height = 30; height < 300; height+= 30){ - targets.locations.push_back(glm::vec3(0, height, 0)); - targets.locations.push_back(glm::vec3(30, height, 0)); - targets.locations.push_back(glm::vec3(-30, height, 0)); - } - for(int z = -40; z > -300; z += -10) - targets.locations.push_back(glm::vec3(10, 3, z)); + for(int height = 30; height < 300; height+= 30) + for(int x = -90; x <= 90; x += 30) + targets.locations.push_back(glm::vec3(x, height, 0)); objects.push_back(&targets); objects.push_back(&brick_fragments); @@ -331,18 +327,19 @@ int main(int argc, char** argv) { activation_area target_spawning; - target_spawning.size = glm::vec3(10, 10, 10); + target_spawning.size = glm::vec3(20, 20, 20); target_spawning.add_area(glm::vec3(10, 0, 10), bob, 1); - target_spawning.add_area(glm::vec3(100, 5, 300), activate_turret, 2); + target_spawning.add_area(glm::vec3(0, 5, 400), activate_turret, 2); objects.push_back(&target_spawning); -*/ - + + + /* wall_block monster_box("cube.obj", "monster1.png", glm::vec3(10, 10, 10)); monster_box.scale = 5.0; monster_box.locations.push_back(glm::vec3(53, -10, 50)); objects.push_back(&monster_box); - -/* + */ + // What if it wasn't a cube? wall_block bwb("cube.obj", "brick.jpg", glm::vec3(20, 20, 20)); bwb.scale = 10; @@ -350,16 +347,19 @@ int main(int argc, char** argv) { bwb.locations.push_back(glm::vec3(-30, 0, 0)); objects.push_back(&bwb); - t.locations.push_back(glm::vec3(100, -5, 300)); - t.locations.push_back(glm::vec3(-100, -5, 300)); + t.locations.push_back(glm::vec3(100, -5, 200)); + t.locations.push_back(glm::vec3(-100, -5, 200)); + t.locations.push_back(glm::vec3(100, -5, 100)); + t.locations.push_back(glm::vec3(50, -5, 100)); t.current_target = &targets; t.current_projectile = &ice_balls; objects.push_back(&t); -*/ + flat_panel p("nutsandbolts.jpg"); - p.addpanel(glm::vec3(63, 0, 50), glm::vec2(2, 2), glm::vec2(2.0, 2.0)); - p.addpanel(glm::vec3(58, 0, 50), glm::vec2(2, 2), glm::vec2(0.5, 0.5)); - p.addpanel(glm::vec3(53, 0, 50), glm::vec2(2, 2), glm::vec2(1, 1)); + p.addpanel(glm::vec3(0, -9.99, 400), glm::vec2(10, 10), glm::vec2(1, 1)); + p.addpanel(glm::vec3(32, -9.99, 450), glm::vec2(5, 5), glm::vec2(2.0, 2.0)); + p.addpanel(glm::vec3(21, -9.99, 450), glm::vec2(5, 5), glm::vec2(0.5, 0.5)); + p.addpanel(glm::vec3(10, -9.99, 450), glm::vec2(5, 5), glm::vec2(1, 1)); objects.push_back(&p); /* Initialize game objects */ diff --git a/turret.h b/turret.h index 0ad4f37..9f082dc 100644 --- a/turret.h +++ b/turret.h @@ -28,8 +28,8 @@ public: countdown = 314; if(!current_target->locations.size()) return; - glm::vec3 target_location = current_target->locations[target_idx]; for(auto l : locations){ + glm::vec3 target_location = current_target->locations[target_idx]; current_projectile->add_projectile(l, 0.2f * glm::normalize(target_location - l), 100000); target_idx++; if(target_idx >= current_target->locations.size()) -- 2.39.5