07-13-2012, 02:57 PM
Everything works until one bullet reaches the end of the form.
The problem is at the Next. This is what I get:
Code:
Public Sub PlayerBullets_Act()
'This method moves the player bullets and detects their collisions. It should be called every
'time the timer ticks
For Each bullet As PictureBox In playerBullets
If (bullet.Location.Y <= 0) Then
'The bullet has moved off of the screen, we need to remove it to conserve system resources
Controls.Remove(bullet)
playerBullets.Remove(bullet)
End If
'TODO: Check for collisions with enemies here
bullet.Location = New System.Drawing.Point(bullet.Location.X, bullet.Location.Y - 2) 'Move the bullet up
Next
End Sub
Quote:Collection was modified; enumeration operation may not execute.
Also known as Rocketalypse.
System.out.println("I prefer Java.");
System.out.println("I prefer Java.");