I want to make a Ball fall and make it stop when it hits the ground. Now I tried this code below, but the ball doesn't move. It thinks the 'collide' is not nothing. But it does not collide. What did I do wrong? Thanks
Code:Dim objects() As PictureBox Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load objects = New PictureBox() {Ball, Ground} End Sub Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Integer) As Integer Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Dim collide As PictureBox = objects.FirstOrDefault(Function(o) o.Bounds.IntersectsWith(Ball.Bounds)) If collide IsNot Nothing Then Else Ball.top = Ball.top + 2 End If End Sub End Class




Reply With Quote