WEBINAR: On-demand webcast
How to Boost Database Development Productivity on Linux, Docker, and Kubernetes with Microsoft SQL Server 2017 REGISTER >
Playing games not set up correctly can be really annoying and frustrating. I'm not a huge gamer, but every now and then I'd like to see if I can beat my score on Spider Solitaire. Getting into the game market now, because of my daughter, I have come to realise how many games there are out there, which were created quickly and haphazardly. Call me stupid, but I believe the most most important part of game design ( doesn't matter what game it is ), is the displaying and smoothness of of all objects. It looks very unprofessional when, upon a certain movement the game flickers or the moved object simply doesn't move quick enough. It is especially bad when the moved object(s) still leave traces of their original location after the move. All these reasons spurred me on, to ensure that I create a proper display class, so that issues like the aforementioned issues never ever arise.
Logic / Explanation
You may be thinking: "How can these issues be fixed, if possible even?" Two words : Double Buffering. What we will do in this article is create a class that can handle all the image buffering. Once we have this class created, we create objects from it for our Preview window, our Splash window as well as our physical game window. In Part 1 of this series we have created the Grid for all the Tetris blocks, and designed the basic user interface. Now, we will take it a tiny step further, by adding more controls and setting default values for all the labels as well as beginning with the actual game's logic. Let us start with the design
Resize your main form where necessary. Not all of the controls added now are 100% essential at this stage, but it is good to have the User Interface up to this point, so that you can also get a larger picture of what will happen in this game, and what is to be expected.
Your design should more or less resemble the following picture