I would like to know if anyone here knows or perhaps remembers "loops" in Visual Basic.
I want to loop some code which happens to be a 2D game.
Once my bitmap asteroid hits the bottom of the form1, how can I get the game to restart from the beginning. I'm not using arrays, just a bunch of asteroids moving down the form to eventually trigger game over.
So In gameover, I have the following. Once this asteroid hits the form, how do I "Loadsettings()" begin the program again.
Part of my program code.
private sub gameover contains the followingCode:Dim rocketleft As Boolean Dim rocketright As Boolean Dim asteroidspeed As Integer Dim asteroiddrop As Integer Dim asteroiddown As Boolean Dim rocketspeed As Integer = 21 Dim missilespeed As Integer = 22 Private Sub Timermain_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timermain.Tick moveasteroid() checkgameover() moverocketship() firemissile() checkhit() End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load loadsettings() End Sub Private Sub loadsettings() asteroiddown = True asteroidspeed = 2 asteroiddrop = 40 checkgameover() rocketspeed = 21 missilespeed = 22 missile.Visible = False firemissile() checkhit() End Sub
Thank you for any assistance.Code: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