lundi 13 mars 2017

visual basic ReRoll If Lands on Double

I'm having trouble with my code. Here I have to make it, so if both intNum1 & intNum2 create a double they must reroll until it isn't a double. This is my current code. Im sure it most likely is something very simple but any help would be appreciated thanks.

    Dim randGen As New Random
    Dim intNum1 As Integer
    Dim intNum2 As Integer
    Dim intTotal As Integer
    Dim intRoll As Integer
    Dim intReRoll As Integer

    intNum1 = randGen.Next(1, 7)
    intNum2 = randGen.Next(1, 7)
    intRoll = randGen.Next(1, 7)
    intReRoll = randGen.Next(1, 7)

    Select Case intNum1
        Case 1
            PicDie1.Image = picOneDot.Image
        Case 2
            PicDie1.Image = picTwoDots.Image
        Case 3
            PicDie1.Image = picThreeDots.Image
        Case 4
            PicDie1.Image = picFourDots.Image
        Case 5
            PicDie1.Image = picFiveDots.Image
        Case 6
            PicDie1.Image = picSixDots.Image
    End Select

    Select Case intNum2
        Case 1
            picDie2.Image = picOneDot.Image
        Case 2
            picDie2.Image = picTwoDots.Image
        Case 3
            picDie2.Image = picThreeDots.Image
        Case 4
            picDie2.Image = picFourDots.Image
        Case 5
            picDie2.Image = picFiveDots.Image
        Case 6
            picDie2.Image = picSixDots.Image
    End Select

    Select Case intRoll
        Case 1
            If intNum1 = intNum2 Or
            intNum2 = intNum1 Then
                randGen.Next(1, 7)
            End If
    End Select


    intTotal = intNum1 + intNum2
    lblTotal.Text = intTotal.ToString


End Sub




Aucun commentaire:

Enregistrer un commentaire