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 trialKoray Erkan
1,235 PointsWhy am I losing?
when I debug the exe, it prints "Player lost", contrary to the video.
2 Answers
William Schultz
2,926 PointsThe problem is you are checking if the invader is neutralized by only checking if it's health is lower than 0 rather than checking if it is < or = 0. So when the invaders health reaches 0, your code still returns false for if it is neutralized instead of true.
Change:
public bool IsNeutralized
{
get
{
return (Health <= 0); //Changed Health < 0 to Health <= 0
}
}
Koray Erkan
1,235 PointsYou are right.
snapshot workspace: https://w.trhou.se/u692drefj8
Steven Parker
231,275 PointsSteven Parker
231,275 PointsTo make it possible for someone to help, you'll need to post your code, or (even better) use the snapshot function in the workspace and provide the link to it.