Results 1 to 3 of 3

Thread: how do i use sprites???

  1. #1
    Guest

    Question

    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.

  2. #2
    Lively Member
    Join Date
    Oct 1999
    Posts
    65

    Simple.

    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.

    Code:
    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.

    "I'm carrying a Geometry book, but I'm not in Geometry...it's crazy...crazy man!"

  3. #3
    Guest

    Question how do i make an imagelist?

    thank you for your help,
    but how do i make an image list?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width