Note: I have completely rewritten and improved this game. Most of my traffic comes from these posts, so I've not deleted them. Please use the new version which can be found here.
Snake is a classic game in which the player controls a snake that moves around and eats fruit. With each piece of fruit that the snake eats, it grows in length by one, and the player earns one point. The player loses the game when the snake either collides with it's tail, or a wall.
This tutorial series will cover the creation of the snake game from start to finish, and will provide full source code at the end. The tutorial will be broken up into several parts, each covering a different section of the game before putting it all together and supplying the source code at the end.
- Part 1: Introduction
- Gives an overview of the game and the tutorial series.
- Protip: You're reading it.
- Part 2: The Game Engine
- Covers the game engine.
- Part 3: Game Board
- Covers the GameBoard class.
- Part 4: The Snake
- Covers the Snake class.
- Part 5: Controller Input
- Covers the input system.
- Part 6: Fruit and Scoring
- Covers spawning and consuming fruit.
- Covers the points system.
- Covers how the snake grows in size.
- Part 7: Putting it All Together
- Goes over a few finishing touches.
- Shows the finished product.
- Contains the complete source code.
Thank a lot for the tutorial. Well done lads!!!
ReplyDeleteNo problem, mate. Granted, it's not the greatest (I've never been great at writing tutorials like this, as I always go back after the fact and change things around to fix minor bugs, or implement new features), but it works. :P
ReplyDeleteOHHH!! Thanks, Man!
ReplyDeleteYou have done a god job for mee too. It's my school work to create such a snake game. I will start trying that out from tomorrow. Isn't it okay if I ask u about any part of that in case I don't understand?
Yeah, feel free. I'd recommend using the newer version of the game though. It's much cleaner and has better documentation.
ReplyDeleteNice Post. I like your blog. Thanks for Sharing.
ReplyDeleteJava Course in Noida