Results 1 to 3 of 3

Thread: need help on moving picturebodx with up and down keys and so on and other stuff

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 1999
    Posts
    219

    Post

    how cna i move a picture box if they press up it goes up and down and it goes down and also how can i make it where it wont go close to any lines like if it get to a line it wont go that way like on pac man and it wont go past the form also how cna i do all that please help me please

    thanx
    justin

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Post

    Set the KeyPreview property of the Form to True. Then add code to the KeyDown event of the Form.

    Select Case KeyCode
    Case vbKeyUp
    Picture1.Top = Picture1.Top - 15 'or whatever
    Case vbKeyDown
    Picture1.Top = Picture1.Top + 15
    Case vbKeyLeft
    Picture1.Left = Picture1.Left - 15
    Case vbKeyRight
    Picture1.Left = Picture1.Left + 15
    End Select

    Good luck!


    ------------------
    Joacim Andersson
    [email protected]
    [email protected]
    www.YellowBlazer.com



  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 1999
    Posts
    219

    Post

    and how do i do the other stuff

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