| | |
Questions about Snake (game) in C or C++
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Feb 2008
Posts: 36
Reputation:
Solved Threads: 0
Hello Guys! it's been a while.
Lately, I've been wanting to study & explore C/C++ more. Because of this, I've done a lot of exercises that was given to us at school and some more around the net, but sadly the one that I'm really looking forward to the the most (snake game) wasn't given to us.
I'm really interested in how the snake game works and I really want to code it myself. I've looked around and googled it but I can't seem to find a guide, all I saw was source codes. I just want to have and idea on how the game works and what are the necessary "things" that I need in order to do that (do I need to know about: structures? array? etc.)
can someone give me an overview or just a slight guide?
Thanks a lot! Peace
Lately, I've been wanting to study & explore C/C++ more. Because of this, I've done a lot of exercises that was given to us at school and some more around the net, but sadly the one that I'm really looking forward to the the most (snake game) wasn't given to us.
I'm really interested in how the snake game works and I really want to code it myself. I've looked around and googled it but I can't seem to find a guide, all I saw was source codes. I just want to have and idea on how the game works and what are the necessary "things" that I need in order to do that (do I need to know about: structures? array? etc.)
can someone give me an overview or just a slight guide?
Thanks a lot! Peace
Why don't you try your own solution?
Rather than looking at someone else's code, and trying to do basically the same thing over again.
Snake:
- snake moves every 'tick' (ticks get quicker as the game progresses)
- snake hits wall - dead
- snake hits snake - dead
- player presses key - snake changes direction
- snake hits food - snake gets longer
That's pretty much all there is to it.
> do I need to know about: structures? array? etc.
Yes.
Or rather, your life will be a lot easier with careful use of these things.
Rather than looking at someone else's code, and trying to do basically the same thing over again.
Snake:
- snake moves every 'tick' (ticks get quicker as the game progresses)
- snake hits wall - dead
- snake hits snake - dead
- player presses key - snake changes direction
- snake hits food - snake gets longer
That's pretty much all there is to it.
> do I need to know about: structures? array? etc.
Yes.
Or rather, your life will be a lot easier with careful use of these things.
•
•
Join Date: Feb 2008
Posts: 36
Reputation:
Solved Threads: 0
Thanks Salem!
I'm actually trying to do it by myself, I don't really understand the codes that I saw & I have no intentions of learning the program using those codes. I just have a couple of questions here: How do I bind the up/down/left/right keys? and the whole game is just loop right? with every movement it goes through an iteration.
Thanks in advance!
I'm actually trying to do it by myself, I don't really understand the codes that I saw & I have no intentions of learning the program using those codes. I just have a couple of questions here: How do I bind the up/down/left/right keys? and the whole game is just loop right? with every movement it goes through an iteration.
Thanks in advance!
Last edited by esy928; Aug 9th, 2009 at 10:40 am.
![]() |
Similar Threads
- Problem in Snake Game (C)
- Snake Game (Game Development)
- Help!!! Snake game program, this is what i got so far. (Java)
- snake game S.O.S (C++)
- please help in this snake game today please (C++)
- Snake game with parameters and it wont work... (Pascal and Delphi)
- Please help me with a java terminal snake game (Java)
- array problem in java "Snake game" (Java)
- Snake Game (Pascal and Delphi)
- [MERGED]can anybody help me with this problem; snake game (Java)
Other Threads in the C Forum
- Previous Thread: Mastermind program
- Next Thread: whats wrong about my program?help me...
| Thread Tools | Search this Thread |
#include * append array arrays asterisks bash binarysearch calculate changingto char character cm copyimagefile creafecopyofanytypeoffileinc createprocess() database dynamic execv feet fgets file floatingpointvalidation fork forloop framework function getlogicaldrivestrin givemetehcodez global grade gtkwinlinux hacking histogram ide include incrementoperators input intmain() iso kernel keyboard kilometer km license linked linkedlist linux list lists locate logical_drives looping loopinsideloop. lowest matrix meter microsoft mqqueue number oddnumber odf opensource openwebfoundation overwrite owf pdf performance pointer posix probleminc process program programming radix recursion recv recvblocked research reversing scripting segmentationfault sequential single socket socketprogramming standard strchr string systemcall testing threads turboc unix urboc user variable wab whythiscodecausesegmentationfault windowsapi






