一个关于幸运52的游戏,改了我一个星期啊,5555~~~(果然还是菜)
虽然有些错,但自己实再是找不出来,哎~~ 还请高手帮忙!不胜感激!
错误:我的图片会重复出现,但我不想这样,要怎样改呢?
啥也不多说了,激动ing...
我靠!!!
程序发不上来
发代码吧
Dim i, n, j, k, s, temp, t, p, prize(0 To 2) As Integer, a(0 To 10) As Integer
Dim sname(0 To 2) As String
Private Sub Command1_Click()
Timer1.Enabled = True
Randomize
n = Int(3 * Rnd)
If i = 0 Then
a(i) = n
ElseIf i > 0 Then
Do While 1 <> 0
If i = 3 Then
MsgBox "没有东西了", 0 + 64, "你真强"
MsgBox "不给你玩儿了", 0 + 64, "走喽~~"
End
End If
For j = 0 To i - 1
If a(j) = n Then
k = 1
End If
Next j
If k = 1 Then
n = Int(3 * Rnd)
ElseIf k = 0 Then
Exit Do
End If
Loop
a(i) = n
i = i + 1
End If
Text1.SetFocus
Text1.Text = ""
Label1.Caption = sname(n)
Image1.Visible = False
Image2.Visible = False
Image3.Visible = False
If n = 0 Then
Image1.Visible = True
ElseIf n = 1 Then
Image2.Visible = True
ElseIf n = 2 Then
Image3.Visible = True
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command3_Click()
If Text1.Text = "" Then
MsgBox "你想吃霸王餐!!", 0 + 64, "门儿都没有!"
Text1.SetFocus
End If
If Text1.Text <> "" Then
p = Int(Text1.Text)
If p < prize(n) Then
MsgBox "低了!", 0, "价格"
Text1.SetFocus
Text1.Text = ""
ElseIf p > prize(n) Then
MsgBox "高了!", 0, "价格"
Text1.SetFocus
Text1.Text = ""
ElseIf p = prize(n) Then
MsgBox "恭喜!", 0, "猜对了!"
s = s + prize(n)
Call Command1_Click
End If
End If
End Sub
Private Sub Form_Load()
sname(0) = "电脑"
sname(1) = "手机"
sname(2) = "MP3"
t = 30
i = 0
prize(0) = 19
prize(1) = 32000
prize(2) = 588
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii < Asc(0) Or KeyAscii > Asc(9) Then
Beep
MsgBox "非法字符", 0, "输入"
KeyAscii = 0
End If
End Sub
Private Sub Timer1_Timer()
Static i As Integer
t = t - 1
Label2.Caption = Str(t) & "秒"
If t = 0 Then
MsgBox "时间到", 0 + 64, "哦,BABY~~"
MsgBox "您得了" & s & "元的东东", 0 + 64, "强"
Timer1.Enabled = False
End
End If
End Sub