You are on page 1of 4

Public Class jogoaltobaixo

Dim vsorteio, vnum, vjogoproduto As Integer


Private Sub btnjogar_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnjogar.Click
lblderrota.Text = ""
lbllegendavalor.Text = ""
lblresultadovitoria.Text = ""
lblsimulacao.Text = ""
lblvalorreal.Text = ""
lbllegenda.Text = ""

brasil.Visible = False
fogao.Visible = False
hamburger.Visible = False
hifi.Visible = False
lavarroupa.Visible = False
portatil.Visible = False
repdominicana.Visible = False
secador.Visible = False
psp.Visible = False
desktop.Visible = False
frigorifico.Visible = False
lcd.Visible = False
Randomize()
vsorteio = Math.Floor(12 * Rnd() + 1)

Select Case vsorteio


Case 1
brasil.Visible = True
vnum = Math.Floor((750 - 500 + 1) * Rnd() + 500)
vjogoproduto = Math.Floor((850 - 400 + 1) * Rnd() + 400)
lbllegendavalor.Text = "Valor anunciado"
lblsimulacao.Text = Format(vjogoproduto, "0.00€")
Case 2
fogao.Visible = True
vnum = Math.Floor((600 - 300 + 1) * Rnd() + 300)
vjogoproduto = Math.Floor((800 - 400 + 1) * Rnd() + 200)
lbllegendavalor.Text = "Valor anunciado"
lblsimulacao.Text = Format(vjogoproduto, "0.00€")
Case 3
hamburger.Visible = True
vnum = Math.Floor((5 - 3 + 1) * Rnd() + 3)
vjogoproduto = Math.Floor((6 - 2 + 1) * Rnd() + 2)
lbllegendavalor.Text = "Valor anunciado"
lblsimulacao.Text = Format(vjogoproduto, "0.00€")
Case 4
hifi.Visible = True
vnum = Math.Floor((800 - 100 + 1) * Rnd() + 100)
vjogoproduto = Math.Floor((1000 - 100 + 1) * Rnd() + 100)
lbllegendavalor.Text = "Valor anunciado"
lblsimulacao.Text = Format(vjogoproduto, "0.00€")
Case 5
lavarroupa.Visible = True
vnum = Math.Floor((800 - 350 + 1) * Rnd() + 350)
vjogoproduto = Math.Floor((1000 - 300 + 1) * Rnd() + 300)
lbllegendavalor.Text = "Valor anunciado"
lblsimulacao.Text = Format(vjogoproduto, "0.00€")
Case 6
lcd.Visible = True
vnum = Math.Floor((1500 - 350 + 1) * Rnd() + 350)
vjogoproduto = Math.Floor((2000 - 300 + 1) * Rnd() + 300)
lbllegendavalor.Text = "Valor anunciado"
lblsimulacao.Text = Format(vjogoproduto, "0.00€")
Case 7
portatil.Visible = True
vnum = Math.Floor((1250 - 450 + 1) * Rnd() + 450)
vjogoproduto = Math.Floor((1500 - 400 + 1) * Rnd() + 400)
lbllegendavalor.Text = "Valor anunciado"
lblsimulacao.Text = Format(vjogoproduto, "0.00€")
Case 8
repdominicana.Visible = True
vnum = Math.Floor((1050 - 500 + 1) * Rnd() + 500)
vjogoproduto = Math.Floor((1250 - 400 + 1) * Rnd() + 400)
lbllegendavalor.Text = "Valor anunciado"
lblsimulacao.Text = Format(vjogoproduto, "0.00€")
Case 9
secador.Visible = True
vnum = Math.Floor((60 - 15 + 1) * Rnd() + 15)
vjogoproduto = Math.Floor((70 - 10 + 1) * Rnd() + 10)
lbllegendavalor.Text = "Valor anunciado"
lblsimulacao.Text = Format(vjogoproduto, "0.00€")
Case 10
psp.Visible = True
vnum = Math.Floor((180 - 250 + 1) * Rnd() + 250)
vjogoproduto = Math.Floor((250 - 100 + 1) * Rnd() + 100)
lbllegendavalor.Text = "Valor anunciado"
lblsimulacao.Text = Format(vjogoproduto, "0.00€")
Case 11
desktop.Visible = True
vnum = Math.Floor((1250 - 450 + 1) * Rnd() + 450)
vjogoproduto = Math.Floor((1500 - 400 + 1) * Rnd() + 400)
lbllegendavalor.Text = "Valor anunciado"
lblsimulacao.Text = Format(vjogoproduto, "0.00€")
Case 12
frigorifico.Visible = True
vnum = Math.Floor((800 - 350 + 1) * Rnd() + 350)
vjogoproduto = Math.Floor((1000 - 300 + 1) * Rnd() + 300)
lbllegendavalor.Text = "Valor anunciado"
lblsimulacao.Text = Format(vjogoproduto, "0.00€")
End Select
End Sub

Private Sub jogoaltobaixo_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles MyBase.Load

End Sub

Private Sub label_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles lbllegendavalor.Click

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnbaixo.Click
lblvalorreal.Text = Format(vnum, "0.00€")
lbllegenda.Text = "Valor real"
If vnum = 0 Then
Dim Player As New System.Media.SoundPlayer
Try
Player.SoundLocation = "erro.wav"
Player.LoadAsync()
If Player.IsLoadCompleted Then Player.Play()
Catch ex As Exception

End Try
lbllegenda.Text = ""
lblvalorreal.Text = ""
MessageBox.Show("Está a fazer batota!!! Clique no botão Jogar")

ElseIf vjogoproduto > vnum Then


Dim Player As New System.Media.SoundPlayer
Try
Player.SoundLocation = "aplausos.wav"
Player.LoadAsync()
If Player.IsLoadCompleted Then Player.Play()
Catch ex As Exception

End Try

lblresultadovitoria.Text = "Você Ganhou!!!"


Else
Dim Player As New System.Media.SoundPlayer
Try
Player.SoundLocation = "boo.wav"
Player.LoadAsync()
If Player.IsLoadCompleted Then Player.Play()
Catch ex As Exception

End Try
lblderrota.Text = "Você Perdeu"
End If
End Sub

Private Sub btncima_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btncima.Click
lblvalorreal.Text = Format(vnum, "0.00€")
lbllegenda.Text = "Valor real"
If vnum = 0 Then
Dim Player As New System.Media.SoundPlayer
Try
Player.SoundLocation = "erro.wav"
Player.LoadAsync()
If Player.IsLoadCompleted Then Player.Play()
Catch ex As Exception

End Try
lbllegenda.Text = ""
lblvalorreal.Text = ""
MessageBox.Show("Está a fazer batota!!! Clique no botão Jogar")
ElseIf vjogoproduto < vnum Then
Dim Player As New System.Media.SoundPlayer
Try
Player.SoundLocation = "aplausos.wav"
Player.LoadAsync()
If Player.IsLoadCompleted Then Player.Play()
Catch ex As Exception

End Try

lblresultadovitoria.Text = "Você Ganhou!!!"

Else
Dim Player As New System.Media.SoundPlayer
Try
Player.SoundLocation = "boo.wav"
Player.LoadAsync()
If Player.IsLoadCompleted Then Player.Play()
Catch ex As Exception

End Try
lblderrota.Text = "Você Perdeu"

End If
End Sub

Private Sub btnlimpar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnlimpar.Click
Dim Player As New System.Media.SoundPlayer
Try
Player.SoundLocation = "reiniciar.wav"
Player.LoadAsync()
If Player.IsLoadCompleted Then Player.Play()
Catch ex As Exception

End Try
lblderrota.Text = ""
lbllegendavalor.Text = ""
lblresultadovitoria.Text = ""
lblsimulacao.Text = ""
lblvalorreal.Text = ""
lbllegenda.Text = ""
brasil.Visible = False
fogao.Visible = False
hamburger.Visible = False
hifi.Visible = False
lavarroupa.Visible = False
portatil.Visible = False
repdominicana.Visible = False
secador.Visible = False
psp.Visible = False
desktop.Visible = False
frigorifico.Visible = False
lcd.Visible = False
vsorteio = 0
vnum = 0
vjogoproduto = 0
End Sub
End Class

You might also like