求一个简单的VB小游戏 要代码和控件 急。。发到1290279431@qq.com

只要通过了老师检查 追加50分
2024年11月15日 06:10
有3个网友回答
网友(1):

'添加一个时间控件就行了
Dim ax(20) As Single, ay(20) As Single, bx(20) As Single, by(20) As Single, c1(20) As Integer, c2(20) As Integer
Dim n As Long
Dim aa As Boolean

Private Sub Form_KeyPress(KeyAscii As Integer)
Dim d As Boolean
If aa = False Then
For i = 1 To 20
If KeyAscii = c1(i) And ay(i) < Me.ScaleHeight Then Call tu2(ax(i), ay(i)): ay(i) = 100: d = True: Exit For
Next i
If d = True Then GoTo 1
For i = 1 To 20
If KeyAscii = c2(i) And by(i) < Me.ScaleHeight Then Call tu2(bx(i), by(i)): by(i) = 100: Exit For
Next i
Else
For i = 1 To 20
If KeyAscii = c2(i) And by(i) < Me.ScaleHeight Then Call tu2(bx(i), by(i)): by(i) = 100: d = True: Exit For
Next i
If d = True Then GoTo 1
For i = 1 To 20
If KeyAscii = c1(i) And ay(i) < Me.ScaleHeight Then Call tu2(ax(i), ay(i)): ay(i) = 100: Exit For
Next i
End If
1:
End Sub

Private Sub Form_Load()
Timer1.Enabled = False
Me.KeyPreview = True
aa = True
Timer1.Interval = 1000
Me.Height = 8000: Me.Width = 8000
Me.BackColor = vbBlack
Scale (0, 0)-(18, 18)
Me.AutoRedraw = True
Me.ForeColor = vbBlack
Me.Line (16, 17)-(18, 18), vbGreen, BF
Me.FontSize = 15
CurrentX = 16.1: CurrentY = 17: Print "开 始 "

End Sub
Sub tu1(X As Single, Y As Single, as1 As Integer)
Me.FontSize = 35
Me.ForeColor = QBColor((Int(X) + as1) Mod 15 + 1)
CurrentX = X: CurrentY = Y
Print Chr(as1)
End Sub

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If X < 18 And X > 16 And Y > 17 And Y < 18 Then
For i = 1 To 20
c1(i) = 0: c2(i) = 0
Next i
Line (0, 0)-(40, 40), vbBlack, BF
Call Form_Load
Timer1.Enabled = True

End If
End Sub

Private Sub Timer1_Timer()
n = n + 1
If aa = True Then
If n < 19.3 Then
Randomize
ay(n) = 0
ax(n) = Rnd * 17

c1(n) = Int(Rnd * 26 + 65)

Else
Randomize
ay(n) = 0
ax(n) = Rnd * 17

c1(n) = Int(Rnd * 26 + 65)

aa = False: n = 0
End If
Else
If n < 19.3 Then
Randomize
by(n) = 0
bx(n) = Rnd * 17

c2(n) = Int(Rnd * 26 + 65)

Else
Randomize
by(n) = 0
bx(n) = Rnd * 17

c2(n) = Int(Rnd * 26 + 65)

aa = True: n = 0
End If
End If
Line (0, 0)-(40, 40), vbBlack, BF
For i = 1 To 20
ay(i) = ay(i) + 1
by(i) = by(i) + 1
Call tu1(ax(i), ay(i), c1(i))
Call tu1(bx(i), by(i), c2(i))
Next i
Me.ForeColor = vbBlack
Me.Line (16, 17)-(18, 18), vbGreen, BF
Me.FontSize = 15
CurrentX = 16.1: CurrentY = 17: Print "开 始 "
End Sub
Sub tu2(X As Single, Y As Single)
Line (X, Y + 0.2)-(X + 0.9, Y + 1.6), vbBlack, BF
End Sub

网友(2):

伸手党 这种题 百度呀 直接下个 又怕雷同。恩 你自己做个猜数字的 游戏啦。 绝对小,而且简单。我是不会个你做的。不会就问

网友(3):

楼上的他不是来找骂的……