Casino Slot Machine


This program creates a simple slot machine game which resembles the real machines played in a casino. In this program, you draw an array of nine shapes which consists of three oval shapes, three squares and three rectangles. VB will automatically labeled the shapes as  shape1(0), shape1(1), shape1(2), shape1(3), shape1(4), shape1(5), shape1(6), shape1(7), shape1(8). Put the first three shapes in position 1(from the left), three shapes in the middle and the last three shapes in the last position. Make them invisible at the start. The shapes will appear randomly using the RND function.

The Interface




The Codes

Private Sub Command1_Click()
a = Int (Rnd * 3)
b = 3 + Int (Rnd * 3)
c = 6 + Int(Rnd * 3)
Label1.Caption = " Welcome to Play"

For i = 0 To 8
Shape1(i).Visible = False
Next i

Shape1(a).Visible = True
Shape1(b).Visible = True
Shape1(c).Visible = True

If b = a + 3 And c = a + 6 Then
Label1.Caption = " Congratulation! Jackpot!"

End If

End Sub

Private Sub Form_Load()
Label1.Caption = " Welcome to Play"

End Sub


[Back to Game Page]