Create Animation Slot Machine



Get 100's of FREE Video Templates, Music, Footage and More at Motion Array: Get this here: https://motionarray.com/stock-motion-graphic. Tim Hunkin makes unusual and often funny old-style mechanical arcade machines for Southwold Pier, and has a couple of pages on how he makes his devices and what parts he uses. I desperately need to make a Steampunk themed one now.

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

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 programImagesgrape.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 programImagesgrape.gif, then you need to modify the LoadPicture method to LoadPicture('D:VB programImagesgrape.gif').

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

sound and the other for the jackpot sound. Below is the video demo of the slot machine simulator.

Copyright©2008 Dr.Liew Voon Kiong. All rights reserved |Contact|Privacy Policy

Create Animation Slot Machine

The slot machines is a game of chance , many different outcomes will appear when the player press the play button. In this program, we draw an array of nine shapes ,VB will automatically labeled the shapes as shape1(0), shape1(1), shape1(2), shape1(3), shape1(4), shape1(5), shape1(6), shape1(7) and shape1(8) respectively. Arrange the shapes into three rows. Write the code so that only three types of shapes appear randomly. Here we want to show only square, oval and rectangle. The appearance can be altered at runtime using the Shape properties. For example, Shape1(o).Shape=0 means it is a rectangle, Shape1(o).Shape=1 is a square and Shape1(o).Shape=2 is an oval shape. The color of the shapes can be customized using the FillColor property of the shape. For example, Shape1(0).Fillcolor=vbRed will give the shape a red color. The design interface is shown below:

Create Animation Slot Machine Software

The Design Interface

Randomness can be achieved by using the Rnd function. We also insert a timer to create the animated effect of a slot machine. The time interval is set to 10 so that the shapes change at a fast rate thus creates the illusion of animation. The program also uses a variable x to control the timer so that it can be stopped when x attain a certain value, otherwise the program will loop forever.

The purpose of this program is just to show how different shapes can appear randomly, therefore many advanced features of a slot machine such as the amount of bet are not programmed here. Those features are available in the professional slot machine.

Create Animation Slot Machine Machines

The Code


When you run the program, you will see the following runtime UI:

The Runtime UI


Create Animation Slot Machine Simulator


Copyright©2008 Dr.Liew Voon Kiong. All rights reserved |Contact|Privacy Policy