Visual Basic (System Stack Overflow Exception)
Hi everyone. I am trying to code my own Space Invaders program for my college course. I am working on this tutorial on YouTube. Link provided here: https://www.youtube.com/watch?v=SsI2GVO1Hxs I have gotten to about 12:00 on the video. As soon as I try to run the code to get my aliens to run right across the screen it doesnt happen and i just get the: "System.StackOverflow exception. 'Exception of type system.stackoverflow exception was thrown. ? I will paste my code on here so everyone can see it. I have pretty much copied the tutorial word for word up until this point so i dont know where i have gone wrong. Bear in mind i am only an absolute beginner so I dont know much at the moment. Still learning. Please help :( Public Class Form1 #Region "Variables" Dim Aliens(18) As PictureBox Dim Lef As Boolean Dim Rig As Boolean Dim movealien As Integer = 3 #End Region Region "Buttons" Private Sub Button1_Click(sender As Object, e As EventArgs) Handles StartGame.Click StartGame.Hide() QuitGame.Hide() Panel1.Show() Movecomp.Enabled = True Movecomp.Start() End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles QuitGame.Click End Sub #End Region #Region "Timers" Private Sub Movecomp_Tick(sender As Object, e As EventArgs) Handles Movecomp.Tick If Lef = True Then MotherShip.Left = MotherShip.Left - 2 End If If Rig = True Then MotherShip.Left = MotherShip.Left + 2 End If movealiens() End Sub #End Region Private Sub Label2_Click(sender As Object, e As EventArgs) End Sub Private Sub MotherShip_Click(sender As Object, e As EventArgs) Handles MotherShip.Click End Sub Region "keypresses" Private Sub movecompleft(sender As Object, e As KeyEventArgs) Handles MyBase.KeyDown If e.KeyValue = Keys.A Then Lef = True End If If e.KeyValue = Keys.D