Rich

Rich

  • NA
  • 17
  • 3.9k

How to loop bitmaps going down a form without using an array

Dec 18 2013 11:59 AM
Hi there,

I would like to know how would I loop this piece of code once it has hit the bottom of the form?

Private Sub moveasteroid()
        'Asteroid 1
        If asteroiddown = True Then
            PictureBox1.Top += asteroidspeed
        Else
            PictureBox1.Left -= asteroidspeed
        End If
        If PictureBox1.Left + PictureBox1.Width > Me.ClientRectangle.Bottom Then
            asteroiddown = False
            PictureBox1.Top += asteroiddrop
        End If


Private Sub checkgameover()
        If PictureBox1.Top + PictureBox1.Width >= Me.ClientRectangle.Bottom And PictureBox1.Visible = True Then
            Timermain.Enabled = False
            MsgBox("Game Over- Region of space not protected!")
        End If


So once this ^ has happened, a box loads explaining the above, once the x is clicked how can I load this all over again? Could someone please explain using an example, this may help other beginners.

Thank you.

Answers (9)