• TwitterFacebookGoogle PlusLinkedInRSS FeedEmail

Snake Game Visual Basic 2010

01.11.2019 

A place to discuss, ask questions and share ideas regarding the Visual Basic programming languages. How to get minecraft mods on xbox. Please up vote anybody who helps with your submission, we want people to keep answering questions. Tips & Guidelines. Please prefix your posts with the version of Visual Basic you are using. Example: VB2010 - VB2015, VB6, VBSCRIPT, VBA.

  1. Visual Basic Game Tutorials
  2. Visual Basic Express
Express

Download source - 57.1 KB (Visual C 6.0 project files); Introduction. The Snake game is a widespread game. It has been done a million times, and is playable on any device. Variants of snake run on things like cellphones to mainframes and Snake has been written in most of the major programming languages, from BASIC, C/C, Pascal, Java, C# to whatever.

Visual Basic Game Tutorials

Posting any code you have will help others better understand what you are trying to do and what you have tried already, even if it doesn't work properly. It also shows that you already tried to solve your problem. If you ask for help, you should come back and let us know how things turned out.

Homework questions are tolerated, please be specific about the question as much a possible. Asking us to write it for you is not going to happen. We also reserve the right to not answer if we think you are just not trying. Tell us what you have tried, to help us give better answers?Communities.Resources.Learning Visual Basic.Related Subreddits. I am writing a snake game in visual studio in visual basic.The playing field is a 2D Array of PictureBoxes. My Snake is a 1D array as type Point.

The snake array is called 'Snake'. When the form loads, Snake(0) is set as New Point(1, 1). I have created a sub routine that moves the snake depending on the arrow key the user presses. This is under a timer. Snake(0) (The snake head) is set to equal Snake(0) + direction (direction is a variable altered by the arrow key that the user presses, eg. When up is pressed direction is set to x: 0 and y: -1)When snake(0) hits a piece of food, the amount of elements in the snake array is set to the length of the array.

Visual Basic Express

EG(If snake(0) = foodPosition Then ReDim Preserve snake(snake.Length) End If)I have created a loop, also under the timer, to make the body of the snake follow the head (eg. The relvant Part for you is this: Public Sub MoveDim newBody As New List(Of Point)Dim PrevPoint As Point = HeadFor Each CurrentBodyPoint In BodyDim PointCopy As Point = CurrentBodyPointCurrentBodyPoint = PrevPointnewBody.Add(CurrentBodyPoint)PrevPoint = PointCopyNextBody = newBodyHead.Offset(DirectionDiff)End SubBasically i take the list of bodypoints and overwrite the first point with the head, the second with the first, the third with the second and so on. And then i move the head of the snake in the choosen direction.