Jump to content
  • Advertisement

Dev Blog - Space Defender HD: Turrets

HunterGaming

620 views

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.

One.png.55b3583a12251066ed1b5da343989057.png

 

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.

ClosestToBase.thumb.png.09292caef58fa83c4c27d95b4292e9b8.png

 

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.

RotateToEnemy.png.da17f1e919b569e333e34b85684d6a64.png

 

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


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!