key board or weigi board?

wizxzard
03-06-2002, 03:37 AM
hi folks im kinda helping someone make a game and we are stcuk on the main function, how do you make the character that we have move according to the key that is pressed like up down left right etc, so far we can only go down or use the button movement. thanx
wizxzard:D :D :D :D

Flyguy
03-06-2002, 04:03 AM
Use the Form_KeyDown event.

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Debug.Print KeyCode
End Sub

wild wolf
03-06-2002, 04:15 AM
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyUp Then
Pictue1.Top = Picture1.Top - 10
End If
If KeyCode = vbKeyLeft Then
Pictue1.Top = Picture1.Top - 10
End If
End Sub


hope this is what u wanted

Aviator
03-06-2002, 05:34 PM
You can do something like this to move left, up, right, or down acoording if the user presses the left, right etc.. keys on the keyboard:

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyLeft
Shape1.Left = Shape1.Left - 10
Case vbKeyRight
Shape1.Left = Shape1.Left + 10
Case vbKeyUp
Shape1.Top = Shape1.Top - 10
Case vbKeyDown
Shape1.Top = Shape1.Top + 10
End Select
End Sub

That should do it if you put a shape on the form (it should work for any object by changing Shape1 to the name of the object). It works better if you set the form's scalemode property to 3 - Pixel.

AcidBoot
03-06-2002, 10:13 PM
Isn't it spelt 'oujia' board? ;)

wizxzard
03-07-2002, 02:25 AM
yes it is but most people wouldnt understand what i ment if i said that. thanx for correction.thanx
wizxzard:D

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum