School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 307,096 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,030 people online right now. Registration is fast and FREE... Join Now!




Snake Game

 

Snake Game, How to program using vb 2005

fearless901

10 May, 2007 - 09:27 PM
Post #1

New D.I.C Head
*

Joined: 10 May, 2007
Posts: 3


My Contributions
i need help programming a snake game step by step can anyone help me out smile.gif im using visual basics 2005 Thanks you

This post has been edited by fearless901: 10 May, 2007 - 09:45 PM

User is offlineProfile CardPM
+Quote Post


capty99

RE: Snake Game

10 May, 2007 - 10:24 PM
Post #2

i am colt mccoy
Group Icon

Joined: 26 Apr, 2001
Posts: 9,791



Thanked: 30 times
Dream Kudos: 550
My Contributions
i could.
but then you double posted.

User is offlineProfile CardPM
+Quote Post

Jayman

RE: Snake Game

10 May, 2007 - 10:46 PM
Post #3

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 8,570



Thanked: 237 times
Dream Kudos: 500
Expert In: Everything

My Contributions
I will give you a shove in the right direction.

1. You will need to dynamically create an array of label controls for the game board. 15 x 15 labels is a good place to start, although you can make the board any size you want.
2. You will need an array of integers to represent the snake on the board.
3. You will need to randomly create an apple at different points on the board. When I created mine I just used the "@" symbol for the apple.
4. You will need to specify a color for the board and a different color for the snake. You will use the BackColor of the labels to set the length of the snake.
5. You will need a timer to control when the snake will move.
6. You will need to check for two possible things that will end the game. If the snake hits a wall or if it hits itself.
7. For each apple the snake eats, the length of the snake will increase by one.
8. You will want to track how long the snake gets in order to supply a score for the user.
9. If you use the arrow keys to control the snake then you will need to override the ProcessCmdKey event. However, if you use letters on the keyboard then you can use the KeyPress or KeyDown events.

It really isn't super hard, but will require some serious thought into the mechanics of the game.

Once you get it completed you will end up with something like this screenshot.



Attached thumbnail(s)
Attached Image
User is offlineProfile CardPM
+Quote Post

fearless901

RE: Snake Game

11 May, 2007 - 08:58 AM
Post #4

New D.I.C Head
*

Joined: 10 May, 2007
Posts: 3


My Contributions
QUOTE(fearless901 @ 10 May, 2007 - 10:27 PM) *

i need help programming a snake game step by step can anyone help me out smile.gif im using visual basics 2005 Thanks you



yea i know i tried to delte the post on the visual basics but didnt know how to sad.gif sry about the double post

and thxs jayman9 ill try to start working on it smile.gif

This post has been edited by fearless901: 11 May, 2007 - 08:59 AM
User is offlineProfile CardPM
+Quote Post

maganga

RE: Snake Game

26 Jul, 2007 - 05:32 PM
Post #5

New D.I.C Head
*

Joined: 26 Jul, 2007
Posts: 1


My Contributions
please teach me the codes of snake game i badly neeed it. Using visual basic version 6.0
User is offlineProfile CardPM
+Quote Post

phongbuj

RE: Snake Game

8 Oct, 2009 - 02:57 AM
Post #6

New D.I.C Head
*

Joined: 8 Oct, 2009
Posts: 1

please give source
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/21/09 11:51AM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month