#pragma once #include "game.h" #include "projectiles.h" class turret : public loaded_object { public: size_t target_idx = 0; gameobject *current_target; // Might be nice if this was a list projectile *current_projectile; turret() : loaded_object("turret.obj", "turret.png", glm::vec3(1, 1, 1)) {} void move() { /* At some rate (every so many calls to this function) * Pick a target (How do we know what targets we have?) * Launch a projectile at it (How do we launch a projectile from here?) */ glm::vec3 target_location = current_target->locations[target_idx]; current_projectile->add_projectile(locations[0], 0.001f * (target_location - locations[0]), 10000); target_idx++; if(target_idx >= current_target->locations.size()) target_idx = 0; } };