Use Visual Basic to self-compilation

zhaozj2021-02-11  186

Use Visual Basic to self-compilation

When I started learning VB, I don't know that VB can make an animation. Later, I know that many animations can be made through the self-compiled subunies DELAY (C's library function) and CLS can make many animations, but there is a disadvantage that it is too memory, As I personally think that the idea should be more important than programming, because once a good idea is the problem, it is a technical problem, and I just like to find new problems and then try to solve it. I can solve it. I can solve it. Learn a lot of useful knowledge and skills. Ok, now there is a good idea to start entering the program.

The first step, if you want to make this game, you must make the ball have a judgmentary movement, however how to handle the exercise of the ball, clearly the method of delay & cls is no longer applicable, because the entire program is running The effect will be very poor, so I think of the small ball with the Shape control to replace the Circle command, then make the ball, this problem is very simple, because the Shape control has the properties of Left and Top, can pass the two Control of individual properties can easily solve the problem of pellets.

In the second step, it will be angularly controlled to the ball, and the angle can be reflected by the attribute LEFT and TOP of Shape. Through the Timer Control, the LEFT and TOP values ​​of the ball will continue to add a value or minus a value, the LEFT of the small ball After the TOP changes, the angle of the pellet can be controlled. It is already possible to move the ball, the next question is to make the ball can perform judgment movement.

In the third step, it can be determined to be determined for the ball, and the LEFT of the ball is changed to minus a value when the LEFT of the ball is larger than the form of schelaleft, so that the height of the ball can also perform similar control. Now it is very convenient to judge the ball for the ball, and the procedure has been completed by half.

In the fourth step, since the ball can be freely moved, you can generate such an idea, which makes the bricks Visible when the Top and Left values ​​of the TOP and LEFT bricks are close to a certain range. For False, then the small ball Top and Left correspond to the corresponding value before contact, the brick can disappear and the might change of the mission, this step is required to solve many technical problems, and can define in the Form's LOAD event Two variables DWD and DHD and two Boolean are DW and DH, controlling the ball to left and upward through DWD and DHD, making DW and DW and Dwing when the border of the ball is in contact with the boundary of the brick. The value of the DH performs corresponding changes, by controlling the two values, the ball can make the spheres with a rebound angle, and the program has been initially formed.

Step 5, to make such a game, there must be a good user interface, in order to allow the might to accept the user's control, I placed a command button on the lower boundary of the form, the command button can pass the arrow keys To control, then add some judgment statements to generate the corresponding movement when the ball Command is in contact, so that a user interface is solved.

In the sixth step, only the last step of the program is now generated, and the brick can be replaced by the command button, and then use the loop statement to set the set of COMMAND controls to load in the program. Ok, It has now been completed now.

转载请注明原文地址:https://www.9cbs.com/read-4888.html

New Post(0)