Professional Casino Slot Machine

 

 

This a professional-looking slot machine resembles the real machines played in the casinos in Las Vegas! In this program, the most important part of the program is inserting three image boxes into the form and program them so that they will display a set of three different pictures randomly when the user presses on the spin button. Therefore, it involve a randomization process. Next, a timer needs to be incorporated into the procedures so that the programs can produce animated effects. In addition, you can also insert the Microsoft Multimedia Control so that it can play sounds in synchronization with the spinning of the slot machine as well as when the player hits the jackpot.

 

The Interface

 

 

The most important part of the program is the spin procedure, which is

a = 1 + Int(Rnd * 3)

b = 1 + Int(Rnd * 3)

c = 1 + Int(Rnd * 3)

 

 If a = 1 Then

Image1(0).Picture = LoadPicture("C:\VB program\Images\grape.gif")

End If

 

If a = 2 Then

Image1(0).Picture = LoadPicture("C: \VB program\Images\cherry.gif")

End If

 

If a = 3 Then

Image1(0).Picture = LoadPicture("C:\VB program\Images\orange.gif")

End If

 

If b = 1 Then

Image1(1).Picture = LoadPicture("C:\VB program\Images\grape.gif")

End If

If b = 2 Then

Image1(1).Picture = LoadPicture("C:\VB program\Images\cherry.gif")

End If

 

If b = 3 Then

Image1(1).Picture = LoadPicture("C:\VB program\Images\orange.gif")

End If

 

If c = 1 Then

Image1(2).Picture = LoadPicture("C:\VB program\Images\grape.gif")

End If

If c = 2 Then

Image1(2).Picture = LoadPicture("C:\VB program\Images\cherry.gif")

End If

If c = 3 Then

Image1(2).Picture = LoadPicture("C:\VB program\Images\orange.gif")

End If

End Sub

 

 The three random variables a, b and c will be randomly assigned the values 1, 2 and 3 through the RND  function. Based on these three random numbers, three different pictures will be loaded into the three image boxes randomly using the LoadPicture method. Animated effects are created by putting the above procedure under the control of Timer1, which will call the spin procedure after every interval until it fulfills a certain condition. Sounds are also added using the Microsoft Multimedia Control to make the game more realistic and interesting. The amount won is controlled by the If….Then   statements

If you like to have the complete source codes of this casino, please download the source codes (plus all other source codes in this tutorial) by donating $2.00 .

 

[Back to Game Page]