Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialThanitsak Leuangsupornpong
7,490 PointsMy game keep me lost even I placed several of towers.
After I run that game it show that I am lost. So I add couple more towers but still keep showing that so any help would be appreciate! I still figuring it out.
Here the link to my snapshot : https://w.trhou.se/l0smazevmp
1 Answer
Steven Parker
231,271 PointsYour towers are shooting dead invaders.
Your tower logic causes the towers to use up their shots on dead invaders, allowing live ones to slip by. On line 19 of Tower.cs you have this, which picks the first target in range:
if(_location.InRangeOf(invader.Location, _range))
But you probably want something more like this, to shoot only at invaders still alive:
if(invader.IsActive && _location.InRangeOf(invader.Location, _range))
Thanitsak Leuangsupornpong
7,490 PointsThanitsak Leuangsupornpong
7,490 PointsWow! Thank you very much, and much appreciate!!!