I need to find a way to program this. I am making a brick break game. I need it to where if the ball hits the brick from its left or right, it does something, and if it hits with its top or bottom, it does something. I tried doing this:
But it majorly screwed up. xuD I need help so bad. I don't know where to start. =) Please help. Thanks!Code:If ((Ball(0).Left + BallW >= Brick(i).Left) Or _ (Ball(0).Left <= Brick(i).Left + BrickW)) And (Ball(0).Top <= Brick(i).Top - BallH And Ball(0).Top + BallH <= Brick(i).Top) Or _ (Ball(0).Top + BallH >= Brick(i).Top + BrickH + 1 And Ball(0).Top <= Brick(i).Top + BrickH - 1) Then Ball(0).SpeedX = -(Ball(0).SpeedX) ElseIf ((Ball(0).Left + BallW >= Brick(i).Left + 1) Or _ (Ball(0).Left <= Brick(i).Left + BrickW - 1)) And (Ball(0).Top <= Brick(i).Top - BallH And Ball(0).Top + BallH <= Brick(i).Top) Or _ (Ball(0).Top + BallH >= Brick(i).Top + BrickH And Ball(0).Top <= Brick(i).Top + BrickH) Then Ball(0).SpeedY = -(Ball(0).SpeedY) End If
Oh, by the way, that is in a for loop. I just didn't put it in, so that is not the problem. =)


Reply With Quote