I was bored and needed to do something to take up some time, so I decided to make a Tower Defense type game. As I programmed my towers I realized that when monsters get in the radius of the tower that ALL the monsters get hit, I need the first monster in line to get shot at until it leaves the radius then the tower goes for the next one that is in the radius. I may just be dense, but I couldn't think of a simple way to do this. Its not really important due to this being a "I was bored project", but If anyone has a suggestion i'm all ears.
Here is the update function in my towers basically if it helps any...
Obviously, I know this code will hit anything, but I need it to hit single targets.
Here is the update function in my towers basically if it helps any...
For Local AllCreeps:Creep = EachIn CreepList If Distance(AllTowers.x%,AllTowers.y%,AllCreeps.x%,AllCreeps.y%) <= (AllTowers.LoS% * 10) AllCreeps.DealDamage(AllTowers.Damage%) EndIf Next
Obviously, I know this code will hit anything, but I need it to hit single targets.