vb.net - Vb2010 - Snake Game Issue -
I am currently making a "snake" game in VB2010. I am using the picture box to make a snake. The snake runs fine and this apple is fine.
But when I change the snake left or above then only displays the first 5 sections of the snake. When the snake travels right or down, it displays the entire snake. I'm stumped completely on what's happening.
To transfer the snake, here is my code.
I proceed as an integer to move the body of snake (= 1) 1 phase (-1) snake (I). X = snake (i - 1). X Circle (I). Y = snake (I-1). Sa Nagbadi (I). Place = new point (nominal). X, snake (I). Y) Snake (i) Serpent = Serp (I-1). On progressing I run 'snake head forward' if left in snake (0). Place = 1 then snake (0) .x = snake (0) .x - 20 snapbody (0). Place = new point (snake (0) .x, snake (0). Y) 'move if other snake (0) .fing = 2 then snake (0). Y = snake (0). Y-20 Snakebird (0). Location = new point (snake (0) .x, snake (0) y. 'Moves right ales of snake (0) .ising = 3 then snake (0). X = snake (0). X + 20 Saperbody (0). Place = new point (snake (0) .x, snake (0) y. 'Moves down ales if snake (0) .fing = 4 then snake (0). Y = Serpent (0). Y + 20Sombody (0). Place = new point (serpent) (0). X, snake (0). Y) End if length + = 1
Here is the code which connects the snake to a segment when it comes in contact with Sepp.
'Check to see if Snake's head is eaten then snake (0). X = Food Left and snake (0). Y = food Then load SnakeBody () 'nap (length -1) .f = snake (length) by keeping the new body in its place. X = snake (length - 1). X -Sombody (0). Bit snake (length). Y = Snake (length - 1) with snake (length). Place = new point (snake) .x, snake (length). Y) Snipbody (length). Vigil = true Christian snake (length - 1) .fing = 2 then searching for snake (length) .x = Snake (Length - 1) X snake (length). Y = Snake (length - 1). Y + snipbody (0) .ite snobbie (length). Location = new point (snake) .x, snake (length). Y) snobbie (length). Qualified = true Christian snake (length - 1) .fing = 3 'then looking right' snake (length). X = Snake (length - 1). X - Snake Body (0). Witth Nag (length). Y = Snake (length - 1). Snake (length). Location = New point (Snake (length) .x, Snake (length). Y) Snakebird (length). Genuine = true Christian snake (length - 1) .fing = 4 then looking at snake (length) .x = Serpent (Length - 1) .x circuit (length). Y = snake (length - 1). Y - Snipbody (0) .teiff snakebite (length). Location = new point (snake (length) .x, snake (length). Y) snapbodie (length) visible = true end if placefood () end if
if someone can tell me What's wrong, I appreciate it!
Thanks
The risk of an estimate (more code can help; , IANA VB expert) - This is a type of border problem where nag (0) .x
and nag (0). Y
can not go below 0 or anything else?
Other suggestions: Check the symptoms of additional code on your left side. I think this may be a problem:
Snake (length). X = snake (length - 1) .x - snake body (0) .Width
If the segment is facing, and we are finally trying to add a piece , Then we need to move to the right, meaning PLUS SnakeBody (0) .Width
.
Snake (length). X = snake (length - 1) .x + snipbody (0). Wide
Hope this helps when I was in school, then I had a snake game, so I feel your pain in order to make all the guidelines and body sections work properly. Happening.
Comments
Post a Comment