Question Array Movement

Topthai

New member
Joined
May 29, 2010
Messages
4
Programming Experience
Beginner
Hey Guys,

I am currently creating Space Invaders, I have created an array and declared it

Me.Enemy = New PictureBox() {Me.picUFO, Me.picUFO, Me.picUFO, Me.picUFO, Me.picUFO, Me.picUFO}
tmrUFO.Enabled = True

Dim Enemy(5) As PictureBox

THe Timer which goes with this is

Private Sub tmrUFO_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrUFO.Tick

Randomize()
Dim WhichEnemy As Integer = Int(Rnd() * 6) ' random number 0-5
Enemy(WhichEnemy).Left += 2 ' move 4 pixels down
If Enemy(WhichEnemy).Left > Me.Height Then ' gone off bottom of form
Enemy(WhichEnemy).Left = -Enemy(WhichEnemy).Height ' send to top of form
End If

End Sub


Only one enemy is moving at the moment????
How do i fix this??:D
 
Try using more than one Picturebox, your array currently has 6 elements that all refer to same Picturebox.
 
Back
Top