Get up to 80 % extra points for free! More info:

Videostop in C# .NET Console

First I wanted to create this game in a classic way and draw the individual blocks directly in the code using ASCII characters. I realized that they need to repeat 5 short strings to render. I assigned a number to each of them (I store them in a string array), and all six block shapes are in the code defined by only a few numbers on just six lines of code, which seems to me very practical and economical.

The block rendering is done by positioning the console cursor on the specified coordinates in the console. However, after rendering the first line, the cursor moves to the beginning of the next line. It's then necessary to set the cursor position for each line. Thus, the resulting effect is that the first whole block is rendered, then the second one, and then the last one. It's also possible to write the score at any time during the main program loop. In our class we were discussing whether it's even possible. - The answer is yes, even in console it's possible to use something similar to the "objects" rendering piece by piece :-)

The application uses the objects concept, but doesn't actually create any object at all. From the object concept it actually uses only class methods, which seems more handy than having everything defined directly in the program main class.

The random number generator imperfection isn't much of an issue here. It actually makes the game more interesting by generating the same numbers sometime. I improved the original simple scoring system into a somewhat more interesting system. Try to play and see for yourself. It's not very easy not to lose all the points, and it forces you not to gamble too much. This gives the game the proper tension.

I admit that I didn't invest much of my time into the graphics, apart from the blocks. At least I give a chance to modify the application - the code is available to download below ;-)


Gallery

Game was created in 2016.

 

Download

By downloading the following file, you agree to the license terms

Downloaded 4x (142.45 kB)
Application includes source codes in language C# .NET

 

All articles in this section
C# .NET Community Projects - Object-Oriented Programming
Game has been written for you by fictum.jiri
Avatar
User rating:
No one has rated this quite yet, be the first one!
Activities