07-14-2012, 11:22 AM
Well, just like the player's bullets, for the enemy you need to setup an array and scroll through the array to check for collisions.
However, if you don't want to do that, and you have only one enemy, you can simply say..
So this makes it so before we check for collisions, we make sure that the enemy actually exists inside of the form.
However, if you don't want to do that, and you have only one enemy, you can simply say..
Code:
'TODO: Check for collisions with enemies here
If bullet.Bounds.IntersectsWith(Me.enemy.Bounds) AndAlso Me.Controls.Contains(enemy) Then
bulletsToRemove.Add(bullet)
Controls.Remove(enemy)
Score += 5
End If
So this makes it so before we check for collisions, we make sure that the enemy actually exists inside of the form.