Hi, I'm working on a tower defense game(Just for fun, i'm not particularly knowledgeable or in love with the genre but it seemed like a managable task for a change) and i'm trying to make it so that when an enemy get's to my main tower(The one you are protecting) , the tower's health(An instance variable) will go down over a period of X seconds.
Now i know how to do the whole remove X damage every X seconds thing, but i can't think of a way of testing if the enemy is within say 2 pixels of my tower.
Another question i have is how can i easily control how many turrets my player can create? I have it so they appear when the
left mouse is clicked but as it stands you could create a
thousand if you like and the on screen counter just keeps going up.....
This is pretty inconvenient as is , especially when i consider adding more than one type of turret and some kind of points system to allow you to spend points to create them in the first place.
If anybody out there has made a tower defense game(and i'm sure some of you must have at some point or another) , i would really like your help,