Advertisement
Chong_IntroCS

SlotMachine

Mar 20th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public Class Form1
  2.     Dim time As Integer = 50
  3.  
  4.     Private Sub Button1_Click(sender As Object, e As EventArgs) Handles SpinButton.Click
  5.         Timer1.Enabled = True
  6.  
  7.  
  8.  
  9.         Randomize()
  10.         ' if button clicked
  11.        ' randomly select item from array
  12.  
  13.         ' How to code the images flipping through
  14.        ' When button clicked, set timer that counts down to a certain amount of time.
  15.        ' How do you get the image to slowly change/wait for the next image?
  16.        ' After time is up, randomly choose an element from the list?
  17.  
  18.         Dim picnumselect As String
  19.         Dim PictureNumber As String() = New String() {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"}
  20.  
  21.  
  22.         picnumselect = Str((Int(Rnd() * 11) + 1))
  23.  
  24.         '    Dim z As String = "C:\Users\chongg\Documents\Visual Studio 2015\"
  25.        '    Dim g As String = "Projects\SlotMachine\SlotMachine\Resources\icon" + picnumselect + ".PNG"
  26.        '    g = g.Replace(" ", "")
  27.  
  28.  
  29.         '   Label1.Text = z + g
  30.  
  31.  
  32.         ' PictureBox.Image = Image.FromFile() chooses an image from the file directory.
  33.        ' PictureBox4.Image = Image.FromFile(z + g)
  34.  
  35.  
  36.  
  37.         'NOW THE PROBLEM IS THAT THE PICTURES ARE NOT RESIZING CORRECTLY BECAUSE IN THE FILE THEY'RE REALLY BIG
  38.  
  39.  
  40.  
  41.     End Sub
  42.  
  43.     Private Sub PictureBox2_Click(sender As Object, e As EventArgs) Handles PictureBox2.Click
  44.  
  45.     End Sub
  46.  
  47.     Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  48.  
  49.     End Sub
  50.  
  51.     Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
  52.         time = time - 1
  53.         Label1.Text = time
  54.  
  55.  
  56.         ' If you have 10 pictures, you'd do time Mod 10 = 0,1,2,3,...9
  57.        If time Mod 5 = 0 Then
  58.             PictureBox2.BackgroundImage = My.Resources.icon3
  59.         ElseIf time Mod 5 = 1 Then
  60.             PictureBox2.BackgroundImage = My.Resources.icon1
  61.         Else
  62.             PictureBox2.BackgroundImage = My.Resources.icon10
  63.         End If
  64.  
  65.  
  66.         If time <= 0 Then
  67.             Timer1.Enabled = False
  68.             time = 50
  69.         End If
  70.  
  71.     End Sub
  72. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement