In the space-invaders game in console, how can I code the event where the bullet hits the enemy. For this may be I need to read which character is in a certain console position. If the character is the enemy's character then it will be marked as kill. But I don't know how can I read the what character is in a console position? Is there some function like ReadCharInConsole(positionX, positionY) in .Net/C#?
Asked
Active
Viewed 55 times
-1
-
1The space-invaders is being shown as a matrix I presume? Then I see no problem in getting the x/y of it. Add code examples – Shlomi Bazel Jul 08 '19 at 07:23
-
1Instead of relying what's on the screen, store the position of the enemy in an array / matrix and then see if that position is currently occupied. – Diado Jul 08 '19 at 07:26
1 Answers
1
Reading directly from console can be difficult however a solution would be storing the game state in a 2d array and reading directly from there.

K.Lesniak
- 27
- 3