How To Make a Visual basic 6 Game

Hello, there today I will show you how to make a really fun game in visual basic 6. The game will be like if you click a command button the button will move to some other location in the form. Every time you will try to click it it will jump around the form. 
Do not make games in Visual Basic in your schools and college and waste time like I did.

So let's get it, guy.

               


Our design should look like this. What I  did, I have added a command button and changed its Name property to showGame and Caption property to Click Me, that's all.
now lets dive into the coding part double-click the Click Me button a code window will pop up
now write the following lines.

Private Sub showGame_click( )
showGame.Left = Rnd( ) * (form1.Width - showGame.Width) 
showGame.Top = Rnd( ) * (form1.Height - showGame.Height) 
End Sub

Explanation:
The code is telling the command button that when the click event will occur the buttons left property will be the Width of the form minus the Width of the button and multiply it Width a random number and same with the top property of the command button.

That's all now run the program. and share it with others and enjoy.
If I went wrong somewhere please mention in the comment.

And thanks for reading.


Comments

Popular posts from this blog

Try To Solve The Superpower Pill Riddle.

Start a World War 3: Redesign This Computer Virus.

Now Smart Watch For Blind Peoples.