Working directly with the console buffer is probably more painful than you want to do. If you really want to try, you can read this MSDN page
But I recommend treating the console as display-only -- you can render your game to it, but don't use it to actually store any information. If you're a Head First C# reader, this would follow the same pattern that you used in the Space Invaders game
or the Beehive Simulator
. (You can think of this as a model-view-controller pattern
: the console represents the view, a Game class represents the controller, and the classes with the various in-game elements like invaders or a ship represent the model.)
So, yes, I think your alternative plan to check all active objects for a collision is the right one. Again, I think the method from the Invaders project will work well. You should be able to come up with a simple LINQ statement to find any objects that collide with a certain coordinate. If your visual elements are larger than one character, consider using a property of type System.Drawing.Rectangle
. You can call its Contains() method
to see if it contains a point (which works really well from inside a LINQ query).
Another alternative, which I think is not as elegant a solution but should work just fine, is to keep track of all of your characters using a Dictionary<System.Drawing.Point, char>. Every time you update a character's position, you update the Dictionary. Then you can use Dictionary.Contains() to see what character it contains.
Does that help?