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 trialMichael Mansperger
2,623 PointsCompile error: TreehouseDefense.Point' does not contain a definition for `y'
Full error message: Game.cs(11,17): warning CS0219: The variable p' is assigned but its value is never used
Point.cs(21,33): error CS1061: Type
TreehouseDefense.Point' does not contain a definition for x' and no exten
sion method
x' of type TreehouseDefense.Point' could be found. Are you missing an assembly reference?
Point.cs(4,11): (Location of the symbol related to previous error)
Point.cs(21,42): error CS1061: Type
TreehouseDefense.Point' does not contain a definition for y' and no exten
sion method
y' of type `TreehouseDefense.Point' could be found. Are you missing an assembly reference?
Point.cs(4,11): (Location of the symbol related to previous error)
Compilation failed: 2 error(s), 1 warnings
Snapshot of workspace: https://w.trhou.se/1i6p86ok9t
1 Answer
Edward Ries
7,388 Pointsreturn DistanceTo(point.x, point.y);
Your Point class has two public readonly variables called X and Y but your trying to pass in a point class and use x and y. Variables are case sensitive. Just upcase the point.x and point.y variables and you should be ok.
Michael Mansperger
2,623 PointsMichael Mansperger
2,623 PointsThat worked, thank you. I forgot to check the location section in the error message.