SteveCRM
Dec 3rd, 1999, 06:24 AM
In my air hockey game (i guess you can call it pong) I got the puck to bounce around the screen, but I can't get it to bounce off of an object. Something always goes wrong. Here is what I used:
'Bounces Puck Around Screen
Image1.Move Image1.Left + DeltaX, Image1.Top + DeltaY
If Image1.Left < Picture1.Left Then DeltaX = 100
If Image1.Left + Image1.Width > Picture1.Width + Picture1.Left Then
DeltaX = -100
End If
If Image1.Top < Picture1.Top Then DeltaY = 100
If Image1.Top + Image1.Height > Picture1.Height + Picture1.Top Then
DeltaY = -100
End If
'Bounces Off Of Paddle
If Image1.Left < Image2.Left Then DeltaX = 100
If Image1.Left + Image1.Width > Image2.Left + Image2.Width Then
DeltaX = -100
End If
Please Help (Please do not send new code, I am comfortable with this for now, please just fix it.)
Thanx.
Steve
'Bounces Puck Around Screen
Image1.Move Image1.Left + DeltaX, Image1.Top + DeltaY
If Image1.Left < Picture1.Left Then DeltaX = 100
If Image1.Left + Image1.Width > Picture1.Width + Picture1.Left Then
DeltaX = -100
End If
If Image1.Top < Picture1.Top Then DeltaY = 100
If Image1.Top + Image1.Height > Picture1.Height + Picture1.Top Then
DeltaY = -100
End If
'Bounces Off Of Paddle
If Image1.Left < Image2.Left Then DeltaX = 100
If Image1.Left + Image1.Width > Image2.Left + Image2.Width Then
DeltaX = -100
End If
Please Help (Please do not send new code, I am comfortable with this for now, please just fix it.)
Thanx.
Steve