Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

C# C# Objects Loops and Final Touches Playing the Game

Elfar Oliver
Elfar Oliver
3,899 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,899 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,899 Points

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