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# C# Objects Loops and Final Touches Playing the Game

Elfar Oliver
Elfar Oliver
3,924 Points

I get an error I can't fix

Game.cs(45,40): error CS1061: Type TreehouseDefense.Level' does not contain a definition forPlay' and no extension method Play' of typeTr eehouseDefense.Level' could be found. Are you missing an assembly reference?
Level.cs(3,11): (Location of the symbol related to previous error)

https://w.trhou.se/vu0ti2jvzf

Elfar Oliver
Elfar Oliver
3,924 Points

Now I've corrected lines 9 and 11 in Level.cs to correctly display "_invaders" and "invaders" instead of "invader" as it was before and now the error I'm receiving is: Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object
at TreehouseDefense.Game.Main () [0x00074] in <06daf5b1b80b42cfacf4489f9165908e>:0

1 Answer

Elfar Oliver
Elfar Oliver
3,924 Points

I did literally nothing and it's fixed. Compiled and got "Player won" as instructed by the video.