Picturebox Moving

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • skynetplus
    New Member
    • Feb 2007
    • 4

    Picturebox Moving

    Ok so far got the following:

    picBall.Left = picBall.Left - 10
    picBall.Top = picBall.Top - 5

    If picBall.Left >= Me.Width Then

    End If

    The top two lines allow the picturebox to move but i now want the code for if the picturebox hits the side then goes another direction. The task is to make a breakout game. I have looked over the internet and all i can find is code from math nerds using x, y, z, a, b, c etc with numbers ranging form 1 to 99 so this is no good as i need to understand it. I have relevant knowledge but not game design.

    Thanks
  • smartchap
    New Member
    • Dec 2007
    • 236

    #2
    You can make it like this:

    Private Sub Command1_Click( )
    Picture1.Left = Picture1.Left - 10
    If Picture1.Left + Picture1.Width < Me.Left Then
    Picture1.Left = Me.Width
    End If

    End Sub

    Similarly for Top also. Place the code in your program as per your need.

    Comment

    • rpicilli
      New Member
      • Aug 2008
      • 77

      #3
      Hi there is a lot of ways to do what you wanna do.


      I think the easy way is to compair to 0 (zero) for top, and left. These are the initial value for the left top corner.

      I hope this help you

      RPicilli

      Comment

      Working...