I am currently in the process of making a snake game using VB.NET… I was just wanting to gather ideas on how to do the body of the snake…
Currently I have a class called SnakeBody which contains the following code:
Public Class SnakeBody
Dim yCoord As Integer
Dim xCoord As Integer
Dim body As PictureBox
End Class
I guess what I am asking is if Dim body As PictureBox a logical thing to put in my class. As in, I am not sure if that is the correct thing to do? To create the actual body of the snake I will have an array of these SnakeBody objects.
If `’Dim body As PictureBox is valid How do I reproduce the same picturebox everytime my snake eats something?
I hop this makes sense… Thanks Alot
Well, it is okay but it is not going to work well in practice. PictureBox is a window, when snakes overlap each other, you’ll obscure part of them with a rectangle. You’ll essentially see one snake in a rectangle with bits of other snakes peeking out past that rectangle.
Use the form’s Paint event to draw the snakes, don’t use a control.