0% found this document useful (0 votes)
2 views2 pages

Slot Original

The document outlines the creation of a slot machine program that includes three image boxes displaying random pictures when a spin button is pressed. It details the use of a randomization process, a timer for animation effects, and the incorporation of sound using Microsoft Multimedia Control. Additionally, it emphasizes the importance of correctly defining file paths for image loading to ensure the program functions properly.

Uploaded by

olesengkgabo14
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Slot Original

The document outlines the creation of a slot machine program that includes three image boxes displaying random pictures when a spin button is pressed. It details the use of a randomization process, a timer for animation effects, and the incorporation of sound using Microsoft Multimedia Control. Additionally, it emphasizes the importance of correctly defining file paths for image loading to ensure the program functions properly.

Uploaded by

olesengkgabo14
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

This is a slot machine that resembles the real slot machines in the casinos.

To create
the project, you need to insert 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. It involves a randomization process. Next, a timer needs to be
incorporated into the procedures so that the program 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. You can design any interface you like. We have created an interface as
shown below:

The Interface

The Video Demo


The Code for Spin Sub Procedure
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
using 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...End
If statements

It is important that you define the correct path for the LoadPicture method, otherwise the
program will not be able to run. For example, our path is C:\VB program\Images\
grape.gif, you need to create the necessary folders and have the necessary image file
if you wish to copy the program directly. If you place the image file in a differently folder,
you need to modify the path accordingly. For example, if your image file is in D:\VB
program\Images\grape.gif, then you need to modify the LoadPicture method to
LoadPicture("D:\VB program\Images\grape.gif").

If you wish to use our image files, you can download from the links below

You might also like