Greetings,
I am making simple Pong application using just one picturebox, which is used as an canvas for everything happening.
The code for collisions is :
I put just MessageBox.show because I wanted to see if the collision will occur.
The thing is, the collision occurs when the paddle is on top left position, but not in any other case. I have made both paddle and ball moveable so you could test it for yourself, I will include it as an attachment. Mind you the game is strongly unfinished because I want to get hang of collisions first.
I am making simple Pong application using just one picturebox, which is used as an canvas for everything happening.
The code for collisions is :
Code:
Public Sub Collision()
If (Player.position.X + Player.width >= _ball.position.X) = True And (Player.position.Y <= _ball.position.Y) = True And (_ball.position.Y <= Player.position.Y + Player.height) = True Then
MessageBox.Show("Bang")
End If
End Sub
The thing is, the collision occurs when the paddle is on top left position, but not in any other case. I have made both paddle and ball moveable so you could test it for yourself, I will include it as an attachment. Mind you the game is strongly unfinished because I want to get hang of collisions first.