想讨教一个关于键盘的下上左右键有关问题
想讨教一个关于键盘的上下左右键问题?
这阵子我在做一个移动游戏,是用键盘的上下左右键是实现的,但我想用W,S,A,D来显示上下左右问题,比喻我下面的代码是上下左右的代码,
Select Case e.KeyCode
Case 37
PictureBox1.Left = PictureBox1.Left - 48
x = x - 1
If PictureBox1.Left < 48 Then
PictureBox1.Left = 0
x = 0
End If
K(7 * y + x).Image = System.Drawing.Image.FromFile(CurDir() & "\tk\k.bmp")
If pd(7 * y + x) = 1 Then
pd(7 * y + x) = 2
js1 = js1 - 1
End If
If pd(7 * y + x) = -1 Then
pd(7 * y + x) = 3
js2 = js2 - 1
End If
Case 38
y = y - 1
PictureBox1.Top = PictureBox1.Top - 48
If PictureBox1.Top < 48 Then
PictureBox1.Top = 0
y = 0
End If
' Call pd()
K(7 * y + x).Image = System.Drawing.Image.FromFile(CurDir() & "\tk\k.bmp")
If pd(7 * y + x) = 1 Then
pd(7 * y + x) = 2
这阵子我在做一个移动游戏,是用键盘的上下左右键是实现的,但我想用W,S,A,D来显示上下左右问题,比喻我下面的代码是上下左右的代码,
Select Case e.KeyCode
Case 37
PictureBox1.Left = PictureBox1.Left - 48
x = x - 1
If PictureBox1.Left < 48 Then
PictureBox1.Left = 0
x = 0
End If
K(7 * y + x).Image = System.Drawing.Image.FromFile(CurDir() & "\tk\k.bmp")
If pd(7 * y + x) = 1 Then
pd(7 * y + x) = 2
js1 = js1 - 1
End If
If pd(7 * y + x) = -1 Then
pd(7 * y + x) = 3
js2 = js2 - 1
End If
Case 38
y = y - 1
PictureBox1.Top = PictureBox1.Top - 48
If PictureBox1.Top < 48 Then
PictureBox1.Top = 0
y = 0
End If
' Call pd()
K(7 * y + x).Image = System.Drawing.Image.FromFile(CurDir() & "\tk\k.bmp")
If pd(7 * y + x) = 1 Then
pd(7 * y + x) = 2