I was bored yesterday so I started making this ASCII game in C++. It's basically Space Invaders, but you have 5 allies with you and there are asteroids that go past, which basically destroy anything in their way. You gain points by killing enemies, and enemies that your allies kill get you points as well. Your score is displayed in the bottom left corner.
It's kind of hard to get into the swing of, gameplay is reasonably fast and the first swarm of enemies before they start spawning randomly is kind of the hardest, but I'd imagine once you get the hang of it you could get reasonably far (if you can be bothered, I guess).
Unfortunately, since I have no idea how to do anything along the lines of a DrawText() setup in C++ ASCII, the screen flickers a fair bit, but you can still see what you're doing. If anyone knows how to do such a thing I'd be grateful for some advice. :)
Both source and the .exe is included. The code isn't exactly the cleanest I've ever written, but I did it one sitting and considering it's not a serious thing anyway I figured it wasn't necessary. The collision is also done in a weird way, because I couldn't be bothered doing the usual thing where I run through all used objects with a for loop and check with collision for all of them, but rather what I do is have each object report their position into a 2D array of strings which represents their type, and then I check for collision in that array. The bad thing about this was the chance of objects overwriting the position of another before collision is checked, but I was able to prevent that being a problem by switching the order of things around, and resultingly an object can only be detected by anything that comes after it in the main loop (so I made the order: Asteroids, Bullets, Enemies, then Player. Ultimately it's kind of like a food chain).
Also, when doing collision that requires two non-player objects to die, (in this case a bullet colliding with a non-player ship) the problem was that all I knew from the array was what type of ship we were colliding with, but not which one in particular it was. So I introduced a secondary array which was basically the same as the first, but instead of the type of ships it stored the array index for it, which I then used to reference the ship I wanted to die.
Anyway, the actual game can be downloaded here:
#- The boundaries of the screen.
^- Your allies.
@- Asteroid, don't get in their way. :)
Left/Right- Move sideways (no vertical movement).