im am just begging in visual basics and i am trying to make a basic game. when the user presses the right key, i want the person to walk forward. i have the art work, what coding do i use for it? please.
Apollo
Apr 19th, 2000, 10:47 PM
Ok, you have to turn the forms KeyPreview property on to true, this way it will actually check what keys the user presses. Then, under the form_keydown event you make a series of if-thens, checking which key was pressed.
I'd suggest using an imagelist to store the different pictures of your character in, if you need more help on that. Just say so.
Private Sub form1_keydown(Keycode as integer, shift as integer)
'Then you do your conditional statements
If keycode = vbkeyright then 'meaning if they pressed right
yourpicturebox.left = yourpicturebox.left + 2 'This makes the distance between your picture and the left of the form 2 greater, thus moving it right (rocket science huh?)
yourpicturebox.picture = yourimagelist.listimages( <Put whatever index value your picture for going right has in here>).picture
end if
end sub
That right there will move your pic right, and display the character pic for moving right in your picture box. The names do not need to be the same, I hope you knew that. And you can apply this to all directions with minimal thinking on your part, now, if you want him to actually walk, it's a little more complicated. Still not hard though. Just say so if you need help.
My ICQ number is 71352013.
My Aol Instant messenger name is Anselmaster.
thank you for your help,
but how do i make an image list?