Advertising

review www.do11warnet.blogspot.com on alexa.com

Monday, January 23, 2012

How to make a simple game

Make a simple game in VB2008
I don't know if anyone else has used or figured out this code yet but i got bored and figured
it out one day so im going to post it i guess...

This is how to make a simple click game.
You need 5 buttons, 3 timers, 2 progress bars, and 2 labels.
So your form should look like this.

Heres the code.

Button 1/Easy

Code:
 Timer1.Start

Button 2/Medium
Code:
 Timer2.Start

Button 3/Hard
Code:
 Timer3.Start

Button 4/Click
Code:
 ProgressBar2.Value -= 2
Button 5/Reset
Code:
ProgressBar1.Value = 100
      ProgressBar2.Value = 100
Timer 1
Code:
 ProgressBar1.Value -= 2
        If ProgressBar1.Value = _
       ProgressBar1.Minimum Then
            Timer1.Stop()
        End If

        If ProgressBar2.Value = _
   ProgressBar2.Minimum Then
            Timer1.Stop()
                End If
Timer 2
Code:
  ProgressBar1.Value -= 2
        If ProgressBar1.Value = _
       ProgressBar1.Minimum Then
            Timer1.Stop()
        End If

        If ProgressBar2.Value = _
   ProgressBar2.Minimum Then
            Timer1.Stop()
                End If
Timer 3
Code:
        If ProgressBar1.Value = _
ProgressBar1.Minimum Then
            Timer3.Stop()
        End If
      
          If ProgressBar2.Value = _
ProgressBar2.Minimum Then
            Timer3.Stop()
        End If
Name label 1:Your health
Name label 2:Computers health

When your debugging it if you keep click after you win you will get an error but once you build it into a .exe it works fine.

No comments:

Post a Comment

Your Comment