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 trial

C#

About adding coordinates to the Tower

Hi steven :D, i opened a new discussion.

i saw ur last answer, what do u mean by argument?, i added a MapLocation object to each of them, beside Tower.cs in the decreasHealth method.

current snapshot: https://w.trhou.se/thdrmqefke

Steven Parker

3 Answers

Steven Parker
Steven Parker
231,236 Points

The "arguments" are the values you pass in the parentheses when you make a call to a method.

So here's your definition of "decreaseHealth" on line 109 of Invader.cs:

        public virtual void decreaseHealth(int factor, MapLocation towerLocation)

It now requires two arguments, an int and a MapLocation.

But here on line 52 of Tower.cs it is being called but given only one argument:

            invader.decreaseHealth(towerPower);

Whenever you change a method signature (which means the number and/or type of arguments), you have to also change every place it is called in the code to match. So the call in Tower.cs needs to pass along the MapLocation now:

            invader.decreaseHealth(towerPower, _location);  // pass tower location also!

And the same issue applies in the two other places it gets called.

i deleted my tries, this is the current snap: https://w.trhou.se/suzjr3k4f6

Steven Parker where i pass the arguments?

Thanks steven now its working and i learned from that! this is the current snap: https://w.trhou.se/othrwt3nt7

I just cant figure out how to deal with the duplicate message at sniperTower

Steven Parker

Steven Parker
Steven Parker
231,236 Points

<noob /> — I think that question has been taken up separately. If this one has been answered, you can mark it solved by choosing a "best answer".
And happy coding!