Sunday 25 December 2011

Merry Christmas!

As a very big thank you to all of those that have read this blog and helped improve it by pointing out my mistakes, I have decided to release an older version of my personal tower defence!

It includes two different types of pathfinding, one that helps the enemies get to the end of the level, and one that detects if the player is “blocking”.

The algorithm used to get the enemies to the end of the level is a variant of the breadth first algorithm. The algorithm generates a direction for each tile which points to a neighbouring tile. The neighbouring tile also contains a direction to a neighbouring tile; eventually if you just keep following the directions you follow a path to the goal!

It also includes a basic level editor, however you will only be able to save levels using the shortcut Ctrl + S, though the code to load the levels is included!

Just be warned the game isn’t at all balanced! Winking smile

So here it is, Merry Christmas!

Saturday 10 December 2011

A* Pathfinding Tutorial : Part 3

Welcome to the final part of the A* pathfinding tutorial! In this tutorial we will be implementing the algorithm I described in part 2 in code!

At the start of this tutorial we will be adding some useful properties and methods to the SearchNode and Pathfinder classes that will make writing the FindPath method more simple.

Then to finish off I will post the full code for FindPath method indicating which piece of code relates to which step of the algorithm posted in the last tutorial!

Edited on the 10/12/2011 at 8:00pm

Thursday 4 August 2011

A* Pathfinding Tutorial : Part 2

Welcome to part two in my series on pathfinding. In this tutorial we will be looking at the actual A* algorithm before we actually start implementing it in code in the next tutorial.

This tutorial will be mostly theory based with very little coding so please stick with it as it is really important to understand the actual algorithm before trying to translate it into code!

Sunday 26 June 2011

A* Pathfinding Tutorial : Part 1

Welcome to part one of my two part series on path finding!

In this first part we will be looking at the amazing A* (A-Star) pathfinding algorithm which is probably one of the most precise and performance friendly pathfinding algorithm out there at the moment.

In part two I am going to show you that although A* is great, that it isn’t always the best algorithm for the job. I will be showing you how we can add pathfinding to the tower defence game made in the previous series using a Breadth First algorithm.

Friday 8 April 2011

Tutorial 15 : Adding Health Bars – Extended

Up until now, we use the enemies colour to represent his health, and while this works quite nicely for our little black blob, it doesn’t work so well with more complex sprites.
In this tutorial we are going to add little health bars that will float above our enemies heads. A lot of the code in this tutorial has been inspired from George Clingerman’s amazing tutorial on health bars. So if you are struggling with this tutorial, I would recommend reading his first as he explains it in more depth than I will.

Friday 25 February 2011

Tutorial 14.5 : Drag and Drop Towers

As has been requested I have written another tutorial about the ability to “Drag and Drop” tower onto the level, at the end of the tutorial I will also discuss zooming and tower upgrades.


Monday 31 January 2011

Tutorial 14 : Polishing the Game

In this, the last tutorial in the series, I will show you how to add a bit of polish to the game by adding a few key features to our game :

  1. Giving the player money when he kills an enemy.
  2. Removing a life when one of the enemies reaches the end of the path.

Both of these things will be implemented in the wave class, however before we make any changes to that we must first make some of the player’s properties settable!

Friday 21 January 2011

Tutorial 13 : Adding the Slow Tower

As a few of you have requested, I will write another tutorial on creating a custom tower type. In this tutorial I will show you how to create a tower the makes the enemies move slower when they are hit with a bullet, and hopefully by the end of this tutorial you will see how easy it is to extend the tower class to make all sorts of different towers!

For simplicities sake, I am only going to show you the changes needed to create the new tower class and not include any details about adding a new button or changing the player AddTower method (If you need help on this see Tutorial 12). However I will provide some placeholder textures that you can use for the slow tower :

slow towerslow buttonslow hoverslow pressed

Tuesday 18 January 2011

Tutorial 12 : Adding a New Tower Type

Sorry for the delay, I have had a very busy at the month! In this tutorial I will show you how to add in two type of cannon, the Spike tower. This tower will be able to shoot 8 bullets in eight different directions at a time.

image

This should be pretty straight forward seeing as we have designed the Tower class to be as extensible as possible, although we will have to make several adjustments to some of the other classes.