Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / DGDK Snake Game (Tutorial/Example Game with source)

Author
Message
DBAlex
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: United Kingdom
Posted: 14th Oct 2013 00:12 Edited at: 14th Oct 2013 00:25
Hi,

Not sure what section this goes in so i've put it here. Today I was browsing around and looking at TGC products and I got the urge to start game development again. I looked on my Windows 7 machine and I still had DarkGDK installed with VS 2008.

I thought I would try and make something useful to release to the community, so today I have started with a Snake game. After a couple of hours work I had a working game.

The source is around 200 lines, it includes a start screen, simple control system, timer based movement, highscore etc.

Note there are no pieces for the snake to eat, the tail just gets longer as time goes on. You will have to add this yourself along with the suggestions below.

Expansions to this could be save/load the highscore to a file, add music/sound effects, use sprites or base a 3D version of snake on the logic in this version. Also needs expanding into classes for at least the tail data structure and X/Y co-ordinates etc.

Hope this is of some use to someone. Over the next few weeks I will hopefully releasing some other small projects like this, if you have any suggestions for short games let me know. I'm thinking Breakout or Asteroids next.

Finally, here is a quick screenshot:


Source code etc is available in Snake.zip attachment. Project is a bit messy, ignore the Backup.cpp, this was just to take parts from the default 2D project.

The Main.cpp source is:


Hope someone finds this useful!

And if you find any bugs let me know.

Thanks, Alex.

Learning DarkGDK, then AppGameKit!

AMD X2 7750, 2GB, 250GB HD, Nvidia 9600GT, XP SP3 & Ubuntu

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-03-28 10:38:17
Your offset time is: 2024-03-28 10:38:17