So I'm now finished with a basic firing mechanism for the turrets. They target, shoot at and kill the enemy ships now and add money for each kill.
I ran into an issue with aiming the turrets at he enemies. The turrets wouldn't turn correctly and and there were a few issues with the aiming that I had to work out. I have a collision sphere around each turret that detects when an enemy enters and leaves its radius. I keep a list of the enemies that is within each turrets power radius and so far have one algorithm for finding the enemy in the list that is closest to the base. I will be adding 2 more algorithms one for strongest enemy and one for weakest so the player will eventually be able to choose between the two.
I ran into a an annoying bug that took a while to get it working right, turrets would turn too slow and not get all the way to the targeted enemy but here is what I ended up with that finally seems to work good. After the rotation I do a quick line trace to determine if there is an enemy ship in front of the turret. This was probably the hardest to figure out and get it working correctly.
All that is left is to pause turrets when the game is paused, subtracting health when the players base is hit and adding 20 rounds. Then work out all the kinks to get it all working together smoothly and make it fun and tricky. Then I should be about ready for a 1 level demo.
http://www.hunter-gaming.com/ https://www.facebook.com/indiehuntergaming/ https://twitter.com/HunterGamingInd