snake game error, moving randomly.
-
Guys i have designed a snake and its prey,the snake is moving but it is moving in all directions(reverse also)how to move this snake correctly to catch that prey and other prey to appear.I am trying this for past 11 days but i cant solve this.help me plzzzzz.......... i have designed it in vb guys...... i have added my code below...........
-
Guys i have designed a snake and its prey,the snake is moving but it is moving in all directions(reverse also)how to move this snake correctly to catch that prey and other prey to appear.I am trying this for past 11 days but i cant solve this.help me plzzzzz.......... i have designed it in vb guys...... i have added my code below...........
What exactly are you expecting from us? You have given us no code to work with. There's nothing here that we can use to give you the correct answer. Adding that you designed it in VB doesn't really add much does it? We can't guess what your code is just from that one statement.
I was brought up to respect my elders. I don't respect many people nowadays.
CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier -
What exactly are you expecting from us? You have given us no code to work with. There's nothing here that we can use to give you the correct answer. Adding that you designed it in VB doesn't really add much does it? We can't guess what your code is just from that one statement.
I was brought up to respect my elders. I don't respect many people nowadays.
CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easierPublic Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Label1.Text = Val(Label1.Text) +10 End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick OvalShape1.Location = New Point(OvalShape1.Location.X, OvalShape1.Location.Y - 1) OvalShape3.Location = New Point(OvalShape3.Location.X, OvalShape3.Location.Y - 1) OvalShape4.Location = New Point(OvalShape4.Location.X, OvalShape4.Location.Y - 1) OvalShape5.Location = New Point(OvalShape5.Location.X, OvalShape5.Location.Y - 1) OvalShape6.Location = New Point(OvalShape6.Location.X, OvalShape6.Location.Y - 1) OvalShape7.Location = New Point(OvalShape7.Location.X, OvalShape7.Location.Y - 1) OvalShape8.Location = New Point(OvalShape8.Location.X, OvalShape8.Location.Y - 1) End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Timer1.Start() If OvalShape1.Location = OvalShape2.Location Then OvalShape2.Hide() End If Timer2.Stop() Timer3.Stop() Timer4.Stop() Timer5.Stop() Timer6.Stop() Timer7.Stop() End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click Timer1.Stop() Timer2.Stop() Timer3.Stop() Timer4.Stop() Timer5.Stop() Timer6.Stop() Timer7.Stop() End Sub Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick OvalShape1.Location = New Point(OvalShape1.Location.X, OvalShape1.Location.y + 1) OvalShape3.Location = New Point(OvalShape3.Location.X, OvalShape3.Location.y + 1) OvalShape4.Location = New Point(OvalShape4.Location.X, OvalShape4.Location.y + 1) OvalShape5.Location = New Point(OvalShape5.Location.X, OvalShape5.Location.y + 1) OvalShape6.Location = New Point(OvalShape6.Location.X, OvalShape6.Location.y + 1) OvalShape7.Location = New Point(OvalShape7.Location.X, OvalShape7.Location.y + 1) OvalShape8.Location = New Point(OvalShape8.Location.X, OvalShape8.Location.y + 1) End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Timer1.Stop()
-
Guys i have designed a snake and its prey,the snake is moving but it is moving in all directions(reverse also)how to move this snake correctly to catch that prey and other prey to appear.I am trying this for past 11 days but i cant solve this.help me plzzzzz.......... i have designed it in vb guys...... i have added my code below...........
-
Guys i have designed a snake and its prey,the snake is moving but it is moving in all directions(reverse also)how to move this snake correctly to catch that prey and other prey to appear.I am trying this for past 11 days but i cant solve this.help me plzzzzz.......... i have designed it in vb guys...... i have added my code below...........
Dude, try out some simpler things first. Name your components accordingly to be able to identify what they are from their names. Then learn to work with debug and breakpoints, as ryanb31 has suggested. It's not my specialty to develop games (I do develop software and web applications professionally) but I've had to create a simple snake game in the beginning of this year, it was in C. I've tried coding first but that made me spend some hours with pen and paper later to fix all the logic. Games are far more complex than usual programs, because their logic involves positioning, collision, and in other cases that aren't yours - gravity, physics and stuff. It's much important to write down your logic with pen and paper before start coding. When your logic works in the paper, then you'll "translate" your notes into code. That works much better. :)