I have written several chapters. It's time to finish.
It's a scorpion. It's a horse-drawn slide. You have to give something to everyone. It's just a fake trick.
Finally, drag a panel control in our form1 form (I just like to drag the control, so sorry) and add a lable to display the score.
Drag it like this:
Then place a Timmer control to set interval to 500 ms and enable = true.
Compile the interval event:
Private void timereffectick (Object sender, eventargs e) {If (GM. isover) {timer1.enabled = false; MessageBox. show ("gameover"); return;} // One step GM. go (); // perform the "Move Down" Operation on the game logic (where to move down, for example, and how all these logics are judged in the game class) GM. display (panel1.handle); // score is displayed after the operation is complete. TEXT = GM. score. tostring ();}
When loading a form:
Public game GM; // masterProgramPrivate void form1_load (Object sender, eventargs e) {// start the game GM = new game (); GM. Start ();}
Compile the onkeydown event of the form (note that do not drag other redundant controls on the form or keydown cannot respond ):
Acceleration fall is just an illusion (set the interval threshold value to a smaller value, and do not forget to recover when onkeyup)
Private void form1_keydown (Object sender, keyeventargs e) {Switch (E. keycode) {case keys. up: // rotate GM. sums (); // GM. left (); break; case keys. left: GM. left (); break; case keys. right: GM. right (); break; case keys. down: timer1.interval = 30; break; case keys. space: // space: timer1.enabled =! Timer1.enabled; break ;}}
The Russian square you wrote on your own feels different ;)
I will operate it myself
What is the error?
It takes a lot of effort to tune this program from the beginning to the next.
Finally, I would like to remind you that this program is based on Microsoft's most advanced drop. Net 3.5. If you don't have one, just copy the source code to a lower version environment without. Net 3.5 and compile it,
Maybe you need to make a small change.Code.
This is the longest one I have ever posted in my blog.ArticleIn the future, there may be more drops, better dedication to everyone.
Now, the full text is complete.
Download the complete project source code
In the end, I wish you a happy Mid-Autumn Festival. It is not easy for you to write all the source code. If you feel that you will leave a comment to let me know.