要先在表單上先做一個shape長方形的
然後下面做六個按鍵
要有:
停止
動
加速
減速
上
下
做好用一定要用即時傳給我~或e-mail哦~^^
shoppingbuy123@yahoo.com.tw
謝謝大大
2006-11-26 11:45:49 · 3 個解答 · 發問者 ? 2 in 電腦與網際網路 ➔ 軟體
完整原始碼如下:
Dim intMove As Integer
Dim intGo As Integer
Private Sub Form_KeyPress(KeyAscii As Integer)
Select Case UCase(Chr(KeyAscii))
'停止
Case "S": intMove = 0
'動
Case "A": intMove = 1
'加速
Case "Q": intMove = 2
'減速
Case "E": intMove = 3
'上
Case "W": intGo = 4
'下
Case "X": intGo = 5
End Select
End Sub
Private Sub Form_Load()
Me.ScaleMode = 3
intMove = 0
intGo = 0
End Sub
Private Sub Timer1_Timer()
Static intRun As Integer
If intGo = 4 Then
Shape1.Top = Shape1.Top - intRun
ElseIf intGo = 5 Then
Shape1.Top = Shape1.Top + intRun
Else
End If
Select Case intMove
Case 0: intRun = 0: intGo = 0
Case 1: intRun = 1
Case 2:
intRun = intRun + 1
If intRun > 10 Then
intRun = 10
Else
intRun = 0
End If
Case 3:
If intRun > 0 Then
intRun = intRun - 1
Else
intRun = 0
End If
End Select
End Sub
2006-11-29 01:28:02 · answer #1 · answered by De-Yu, Lai 3 · 0⤊ 0⤋
好熟悉ㄉ題目阿
2006-12-01 12:15:41 · answer #2 · answered by 佳蓉 2 · 0⤊ 0⤋
以前寫過,但是多了左右及對角6個方向,不妨下載去改一改YSI空間(只能放7天):點我下載zUpload空間(存放時間未知):Download file
2006-11-28 08:56:51 · answer #3 · answered by W.J.S. 7 · 0⤊ 0⤋