classicMode.vb

 Public Class classicMode
    Dim life As Double = 10
    Function updatelife()
        lifeBox.Text = Format(life)
    End Function
    Private Sub classicMode_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        redWire1.Image = wirePictures.Images(0)
        redWire2.Image = wirePictures.Images(0)
        redWire3.Image = wirePictures.Images(0)
        If bombSettings.timerControl.Text = 1 Then
            Timer1.Start()
        ElseIf bombSettings.timerControl.Text = 0 Then
            Timer1.Stop()
        End If
    End Sub

    Private Sub SettingsToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles SettingsToolStripMenuItem.Click
        bombSettings.Show()
    End Sub

    Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
        If timeLeft.Text = 0 Then
            Timer1.Stop()
            life -= 1
            updatelife()
            If life <= 0 Then
                Dim ask As MsgBoxResult

                ask = MsgBox("Sorry, you are dead. Play again?", MsgBoxStyle.YesNo, "Game Over")

                If ask = MsgBoxResult.No Then
                    MsgBox("Thanks for Playing!", MsgBoxStyle.OkOnly, "Goodbye...")
                    Me.Close()
                    mainForm.Show()
                ElseIf ask = MsgBoxResult.Yes Then
                    life = 10
                    updatelife()
                End If
            Else
                boomBox.Visible = True
                MessageBox.Show("Oops, you blew up!", "BOOM!")
            End If
            'reset the timers
            timeLeft.Text = 10
            boomBox.Visible = False
            Timer1.Start()
        End If
        timeLeft.Text = timeLeft.Text - 1 'increase the value of the timers
    End Sub

    Private Sub redWire1_Click(sender As System.Object, e As System.EventArgs) Handles redWire1.Click
        wireCheck.Text = 1
        checkTimer.Start()
        checkIfWin()
    End Sub

    Private Sub redWire2_Click(sender As System.Object, e As System.EventArgs) Handles redWire2.Click
        wireCheck.Text = 2
        checkTimer.Start()
        checkIfWin()
    End Sub

    Private Sub redWire3_Click(sender As System.Object, e As System.EventArgs) Handles redWire3.Click
        wireCheck.Text = 3
        checkTimer.Start()
        checkIfWin()
    End Sub

    Private Sub checkTimer_Tick(sender As System.Object, e As System.EventArgs) Handles checkTimer.Tick
        If timerRound.Text = 0 Then
            Timer1.Stop()
            timerRound.Text = 1
            checkTimer.Stop()
        End If
        If wireCheck.Text = 1 Then
            redWire1.Image = wirePictures.Images(1)
        ElseIf wireCheck.Text = 2 Then
            redWire2.Image = wirePictures.Images(1)
        ElseIf wireCheck.Text = 3 Then
            redWire3.Image = wirePictures.Images(1)
        Else
        End If
        timerRound.Text = timerRound.Text - 1
    End Sub
    Function getRndNumber()
        If bombSettings.levelOfDifficulty.Text = 1 Then
            Return Math.Floor(Rnd() * 3) + 1
        ElseIf bombSettings.levelOfDifficulty.Text = 0 Then
            Return Math.Floor(Rnd() * 2) + 1
        ElseIf bombSettings.levelOfDifficulty.Text = 2 Then
            Return Math.Floor(Rnd() * 4) + 1
        End If
    End Function
    Function checkIfWin()
        If getRndNumber() = 1 Then
            win()
        Else
            lose()
        End If
    End Function
    Function lose()
        boomBox.Visible = True
        life -= 1
        updatelife()
        If life <= 0 Then
            Dim ask As MsgBoxResult

            ask = MsgBox("Sorry, you are dead. Play again?", MsgBoxStyle.YesNo, "Game Over")

            If ask = MsgBoxResult.No Then
                MsgBox("Thanks for playing BOMB V.5!", MsgBoxStyle.OkOnly, "Goodbye...")
                End
            ElseIf ask = MsgBoxResult.Yes Then
                life = 10
                updatelife()
                redWire1.Image = wirePictures.Images(0)
                redWire2.Image = wirePictures.Images(0)
                redWire3.Image = wirePictures.Images(0)
                boomBox.Visible = False
            End If
        Else
            MessageBox.Show("Oops, you blew up!", "BOOM!")
            redWire1.Image = wirePictures.Images(0)
            redWire2.Image = wirePictures.Images(0)
            redWire3.Image = wirePictures.Images(0)
            boomBox.Visible = False
        End If
    End Function
    Function win()
        Timer1.Stop()
        timeLeft.Text = 10
        life += 2
        updatelife()
        If life >= 15 Then
            Dim ask As MsgBoxResult

            ask = MsgBox("Congratulations! You defused all of the BOMBs! Play Again?", MsgBoxStyle.YesNo, "Winner")

            If ask = MsgBoxResult.No Then
                MsgBox("Thanks for playing BOMB V.5!", MsgBoxStyle.OkOnly, "Goodbye...")
                Me.Close()
            ElseIf ask = MsgBoxResult.Yes Then
                life = 10
                updatelife()
                redWire1.Image = wirePictures.Images(0)
                redWire2.Image = wirePictures.Images(0)
                redWire3.Image = wirePictures.Images(0)
            End If
        Else
            MessageBox.Show("One more BOMB has been defused!", "BOMB De-Fused")
            redWire1.Image = wirePictures.Images(0)
            redWire2.Image = wirePictures.Images(0)
            redWire3.Image = wirePictures.Images(0)
        End If
    End Function

    Private Sub ExitToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles ExitToolStripMenuItem.Click
        mainForm.Show()
        Me.Close()
    End Sub

    Private Sub NewGameToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles NewGameToolStripMenuItem.Click
        life = 10
        updatelife()
        If bombSettings.timerControl.Text = 1 Then
            Timer1.Stop()
            timeLeft.Text = 10
            Timer1.Start()
        Else
        End If
    End Sub

    Private Sub RulesToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles RulesToolStripMenuItem.Click
        Timer1.Stop()
        MessageBox.Show("Click on a wire to try to defuse the bomb before time runs out. If you get it right, your lives go up two, and nobody gets hurt. If you are wrong, or if you run out of time, you are blown up and you lose a life.", "Rules")
        If bombSettings.timerControl.Text = 1 Then
            Timer1.Start()
        Else
        End If
    End Sub

    Private Sub UnpauseGameToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles UnpauseGameToolStripMenuItem.Click
        If bombSettings.timerControl.Text = 1 Then
            Timer1.Start()
        Else
        End If
    End Sub

    Private Sub PauseGameToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles PauseGameToolStripMenuItem.Click
        If bombSettings.timerControl.Text = 1 Then
            Timer1.Stop()
        Else
        End If
    End Sub

    Private Sub AboutToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles AboutToolStripMenuItem.Click
        Timer1.Stop()
        about.Show()
        If bombSettings.timerControl.Text = 1 Then
            Timer1.Start()
        Else
        End If
    End Sub

    Private Sub ContactToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles ContactToolStripMenuItem.Click
        Timer1.Stop()
        MessageBox.Show("If you find any bugs, or have suggestions to improve this game, please email CuBe Labs head programmer at towers.luke@gmail.com", "Contact")
        If bombSettings.timerControl.Text = 1 Then
            Timer1.Start()
        Else
        End If
    End Sub

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        mainForm.Show()
        Me.Close()
    End Sub
End Class

Project Homepage: