void AI::enemy3Update(Enemy &enemy, const float dt) { //create the radius if the circle you want the enemy to move float radius = 5.0f; //this will represent the angle in the circle the enemy will be in float angle = 0.0f; //set the angle to the current time settings so it continous to incrememnt //as the enemy is on the screen float angle = dt; //create a vector that represents the enemies current position D3DXVECTOR3 tempVel = enemy.getPosition(); //set the enemy position as the center of the circle D3DXVECTOR3 origin = tempVel; //make the new enemy position depending on sin and cos curves tempVel.x = origin.x + cos(angle) * radius; tempVel.y = origin.y + sin(angle) * radius; D3DXVec3Normalize(&tempVel, &tempVel); tempVel *= ENEMY_SPEED; enemy.setVelocity(tempVel); // Check if enemy should drop a mine float mineFireRate = enemy.getMineFireRate(); enemy.setMineFireRate(mineFireRate -= dt); if (mineFireRate <= 0.0f) { enemy.dropMine(); enemy.setMineFireRate(ENEMY_MINE_FR); } }