]> isoptera.lcsc.edu Git - example_engine/.git/commitdiff
Minor revision to target layout
authorSeth <sslong@lcsc.edu>
Wed, 23 Oct 2024 23:24:18 +0000 (16:24 -0700)
committerSeth <sslong@lcsc.edu>
Wed, 23 Oct 2024 23:24:18 +0000 (16:24 -0700)
helpers.cpp
main.cpp
turret.h

index 36c5882d64fbaab72b22c77ae8310bd4574f730e..ef177f900d4b87c86c045ba8342ac10c2aeb84cd 100644 (file)
@@ -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);
index 031841a412e54bff5175088d45febb0934ca79ee..f0c1e900fa1c7db1bc83f164810eb5e091997e93 100644 (file)
--- 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 */
index 0ad4f37dba430168bca1785a6ea2091a8f1eb4da..9f082dc5f84a84604284a4717f7b44ae65c94cb6 100644 (file)
--- 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())