-
vb help, again
sorry for my extensive asking for help about vb...but..........i am trying to make a SMALL rpg like game....for the movement of the character i use:
If KeyCode = vbKeyD Then Image1.Left = Image1.Left + 25
If KeyCode = vbKeyA Then Image1.Left = Image1.Left - 25
If KeyCode = vbKeyW Then Image1.Top = Image1.Top - 25
If KeyCode = vbKeyS Then Image1.Top = Image1.Top + 25
is there any other way that is more proficient to do this? also, what i really want to be answered is that when i put a label and a command button onto the form, the movement doesnt work.....i figure its because the command button is shortcuted(ie, has the gray little line around it where if i just press space it executes)...is there any way to fix this? thanks!
-
Is the KeyPreview property of your form set to True? If not it should be. Where do you have that code? BTW, I may have already responded to one of your other question with this same suggestion, but a much better place to ask questions about VB is the VB Forums.
-
the code is in: Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) and setting the form property keypreview to true made it work! thanks a lot!!! and thanks for the link