Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Form1
- Dim time As Integer = 25
- Dim time2 As Integer = 47
- Dim time3 As Integer = 75
- Dim picnumber As String
- Dim picnumber2 As String
- Dim picnumber3 As String
- Dim totalcash As Integer = 1000
- Dim betmoneymax As Integer = 0
- Dim betmoney As Integer = 0
- ' in order to play, total cash has to be greater than zero. cant bet more than they have.
- ' before spin, check how much cash there is, cant bet more than you have.
- Private Sub Button1_Click(sender As Object, e As EventArgs)
- End Sub
- Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
- Randomize()
- time = time - 1
- Label1.Text = time
- 'picnumber = Str((Int(Rnd() * 6) + 1))
- 'Label2.Text = picnumber
- If time Mod 6 = " 0" Then
- PictureBox2.BackgroundImage = My.Resources.icon1
- ElseIf time Mod 6 = " 1" Then
- PictureBox2.BackgroundImage = My.Resources.icon2
- ElseIf time Mod 6 = " 2" Then
- PictureBox2.BackgroundImage = My.Resources.icon3
- ElseIf time Mod 6 = " 3" Then
- PictureBox2.BackgroundImage = My.Resources.icon4
- ElseIf time Mod 6 = " 4" Then
- PictureBox2.BackgroundImage = My.Resources.icon5
- ElseIf time Mod 6 = " 5" Then
- PictureBox2.BackgroundImage = My.Resources.icon6
- End If
- If time <= 0 Then
- Timer1.Enabled = False
- time = 25
- End If
- 'FIGURE OUT HOW TO RESIZE IMAGE IF YOU WNAT TO USE THIS CODE
- Dim z As String = "C:\Users\chongg\Documents\Visual Studio 2015\"
- ' substitute values stored in the variables into the string. That's why we needed to convert them from int -> string earlier
- Dim g As String = "Projects\SlotMachine\SlotMachine\Resources\slotpics\icon" + (picnumber) + ".PNG"
- g = g.Replace(" ", "")
- ' PictureBox2.Image = Image.FromFile(z + g)
- ' PictureBox2.BackgroundImageLayout = ImageLayout.Stretch
- If Timer1.Enabled = False Then
- If picnumber = " 1" Then
- PictureBox2.BackgroundImage = My.Resources.icon1
- ElseIf picnumber = " 2" Then
- PictureBox2.BackgroundImage = My.Resources.icon2
- ElseIf picnumber = " 3" Then
- PictureBox2.BackgroundImage = My.Resources.icon3
- ElseIf picnumber = " 4" Then
- PictureBox2.BackgroundImage = My.Resources.icon4
- ElseIf picnumber = " 5" Then
- PictureBox2.BackgroundImage = My.Resources.icon5
- Else
- PictureBox2.BackgroundImage = My.Resources.icon6
- End If
- End If
- 'if you dont get three in a row, you lose the bet
- End Sub
- Private Sub SpinButton_Click(sender As Object, e As EventArgs) Handles SpinButton.Click
- Randomize()
- Timer1.Enabled = True
- Timer2.Enabled = True
- Timer3.Enabled = True
- totalamount_label.Text = totalcash
- 'If totalcash >= 0 Then
- ' notenoughmoney_label.Visible = True
- ' Application.Exit() 'get rid of this and change to something else
- 'End If
- picnumber = Str((Int(Rnd() * 6) + 1))
- Label2.Text = picnumber
- picnumber2 = Str((Int(Rnd() * 6) + 1))
- Label4.Text = picnumber2
- picnumber3 = Str((Int(Rnd() * 6) + 1))
- Label6.Text = picnumber3
- 'if PictureBox2 = PictureBox3 = PictureBox4 then
- 'totalcash = bet money + pay lines
- End Sub
- Private Sub PictureBox4_Click(sender As Object, e As EventArgs) Handles PictureBox4.Click
- End Sub
- Private Sub PictureBox2_Click(sender As Object, e As EventArgs) Handles PictureBox2.Click
- End Sub
- Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
- Randomize()
- time2 = time2 - 1
- Label3.Text = time2
- ' picnumber2 = Str((Int(Rnd() * 6) + 1))
- 'Label4.Text = picnumber2
- If time2 Mod 6 = " 0" Then
- PictureBox3.BackgroundImage = My.Resources.icon1
- ElseIf time2 Mod 6 = " 1" Then
- PictureBox3.BackgroundImage = My.Resources.icon2
- ElseIf time2 Mod 6 = " 2" Then
- PictureBox3.BackgroundImage = My.Resources.icon3
- ElseIf time2 Mod 6 = " 3" Then
- PictureBox3.BackgroundImage = My.Resources.icon4
- ElseIf time2 Mod 6 = " 4" Then
- PictureBox3.BackgroundImage = My.Resources.icon5
- ElseIf time2 Mod 6 = " 5" Then
- PictureBox3.BackgroundImage = My.Resources.icon6
- End If
- 'when you submit this you need three files
- ' .exe file
- ' pdf of the design
- ' link to ur pastebin where ur going to copy all your code
- If time2 <= 0 Then
- Timer2.Enabled = False
- time2 = 47
- End If
- If Timer2.Enabled = False Then
- If picnumber2 = " 1" Then
- PictureBox3.BackgroundImage = My.Resources.icon1
- ElseIf picnumber2 = " 2" Then
- PictureBox3.BackgroundImage = My.Resources.icon2
- ElseIf picnumber2 = " 3" Then
- PictureBox3.BackgroundImage = My.Resources.icon3
- ElseIf picnumber2 = " 4" Then
- PictureBox3.BackgroundImage = My.Resources.icon4
- ElseIf picnumber2 = " 5" Then
- PictureBox3.BackgroundImage = My.Resources.icon5
- Else
- PictureBox3.BackgroundImage = My.Resources.icon6
- End If
- End If
- End Sub
- Private Sub Timer3_Tick(sender As Object, e As EventArgs) Handles Timer3.Tick
- Randomize()
- time3 = time3 - 1
- Label5.Text = time3
- ' picnumber3 = Str((Int(Rnd() * 6) + 1))
- 'Label6.Text = picnumber3
- If time3 Mod 6 = " 0" Then
- PictureBox4.BackgroundImage = My.Resources.icon2
- ElseIf time3 Mod 6 = " 1" Then
- PictureBox4.BackgroundImage = My.Resources.icon6
- ElseIf time3 Mod 6 = " 2" Then
- PictureBox4.BackgroundImage = My.Resources.icon3
- ElseIf time3 Mod 6 = " 3" Then
- PictureBox4.BackgroundImage = My.Resources.icon4
- ElseIf time3 Mod 6 = " 4" Then
- PictureBox4.BackgroundImage = My.Resources.icon5
- ElseIf time3 Mod 6 = " 5" Then
- PictureBox4.BackgroundImage = My.Resources.icon1
- End If
- 'when you submit this you need three files
- ' .exe file
- ' pdf of the design
- ' link to ur pastebin where ur going to copy all your code
- If time3 <= 0 Then
- Timer3.Enabled = False
- time3 = 75
- End If
- If Timer3.Enabled = False Then
- If picnumber3 = " 1" Then
- PictureBox4.BackgroundImage = My.Resources.icon1
- ElseIf picnumber3 = " 2" Then
- PictureBox4.BackgroundImage = My.Resources.icon2
- ElseIf picnumber3 = " 3" Then
- PictureBox4.BackgroundImage = My.Resources.icon3
- ElseIf picnumber3 = " 4" Then
- PictureBox4.BackgroundImage = My.Resources.icon4
- ElseIf picnumber3 = " 5" Then
- PictureBox4.BackgroundImage = My.Resources.icon5
- Else
- PictureBox4.BackgroundImage = My.Resources.icon6
- End If
- End If
- End Sub
- Private Sub bet_max_button_Click(sender As Object, e As EventArgs) Handles bet_max_button.Click
- If totalcash >= 0 Then
- betmoneymax = totalcash
- betmoney_label.Text = betmoneymax
- End If
- End Sub
- Private Sub bet_one_button_Click(sender As Object, e As EventArgs) Handles bet_one_button.Click
- If totalcash >= 0 Then
- betmoney = betmoney + 10
- betmoney_label.Text = betmoney
- End If
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement