The first step is to make this game possible. However, how to deal with the movement of the ball? Obviously the delay&cls method is no longer applicable, because the screen is constantly cleared when the entire program is running. The effect will be very poor, so I thought of using the shape control to replace the small ball drawn with the circle command, and then make the ball move. This problem is very simple, because the shape control has left and top attributes, which can be controlled by The control of each attribute can easily solve the ball movement problem.
In the second step, the angle of the ball will be controlled. The angle can be reflected by the attributes left and top of the shape. The timer control is used to continuously add or subtract a value to the left and top values of the ball. The left value of the ball is After changing it at the same time as top, you can control the angle of the ball. At this point, the ball can be made to move. The next problem is to enable the ball to make judgmental movements.
The third step is to control the ball decisively. When the left of the ball is greater than the scaleleft of the form, the left of the ball is changed to minus a value. By analogy, the height of the ball can also be controlled similarly. , now it is very convenient to make judgmental movements on the ball. At this step, the program is already half completed.
The fourth step, since the ball can move freely, we can come up with the idea that when the top and left values of the top and left bricks of the ball are close to a certain range, the conditions are established to make the bricks visible. is false, then the top and left of the ball are added to the corresponding opposite values before contact, so that the bricks disappear and the ball changes its trajectory. The implementation of this step requires solving a lot of technical issues. Question, you can define two variables Dwd and Dhd and two Boolean quantities as Dw and Dh in the load event of the form. Use Dwd and Dhd to control the ball to move left and upward. When the ball is in contact with the boundary of the form or When the boundaries of the bricks come into contact, the values of Dw and Dh change accordingly. By controlling these two values, the ball can move in a manner consistent with the rebound angle. Now the program has been initially formed.
The fifth step is to make such a game, there must be a good user interface. In order to make the ball accept the user's control, I placed a command button on the lower border of the form, which can be controlled by the arrow keys. To control, and then add some judgment statements to cause the ball to move accordingly when the command comes into contact, such a user interface is solved.
Step six, now only the last step of the program is left, which is to generate the arrangement of bricks. The bricks can be replaced by command buttons, and then use a loop statement to load the set command control array when the program is running. Okay, Everything is done now.
->