basically in my nibbles-clone game here i've got a picturebox (it's a pic of a red dot) that moves around the window and in the timer's tick event the dot moves 1 space (7 pixels in any of the basic 4 directions, no diagonals) then a new picture box is placed in that spot like so:
so now i've got a bunch of these being added just like i want them to, but i need to have the one at the "tail" be removed and i'm not sure how to search the collection looking for that last one and removing it
makes for a nifty etch-a-scetch thing right now
VB.NET:
'This works fine
'picDot is the
Private Sub tmrTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrTimer.Tick
Dim PicBx As New PictureBox
With PicBx
.Image = ilsSnake.Images(0)
.SizeMode = PictureBoxSizeMode.AutoSize
.Visible = True
Select Case intDirection
Case Direction.Up
picDot.Top -= .Height
.Top = picDot.Top
.Left = picDot.Left
Case Direction.Down
picDot.Top += .Height
.Top = picDot.Top
.Left = picDot.Left
Case Direction.Left
picDot.Left -= .Width
.Left = picDot.Left
.Top = picDot.Top
Case Direction.Right
picDot.Left += .Width
.Left = picDot.Left
.Top = picDot.Top
End Select
End With
Me.Controls.Add(PicBx)
End Sub
so now i've got a bunch of these being added just like i want them to, but i need to have the one at the "tail" be removed and i'm not sure how to search the collection looking for that last one and removing it
makes for a nifty etch-a-scetch thing right now