|
General Details
|
|
JavaScript
|
|
Posted 90 Days Ago
|
|
658 Views
|
|
Received 2 Ratings
|
|
Snake Game
Description
A basic snake game that ONLY works on FireFox. I was inspired to create this after seeing a Mario javascript based game the other day. Took about 4 hours to develop this game and all i wanted to achieve was a working version of the game to prove to myself i could write the algorithms needed. I am NOT going to make this cross compatible with other browsers since that was not the aim of me making this game.
The game starts off with a 500 x 700 grid and you have to eat the apples to grow. Even though there are some strange settings such as "setting_fixed_tail" which when set to true, will keep the snake constantly growing! lol.
Eventually i will convert this algorithm across to software instead of using javascript making it in to a proper game - with two players, high scores, etc.
To run this... save the source code in a file called: snake.html & open it with firefox. The game will start straight away.
Alternatively... open the zip file attachment, extract it to your desktop... and open the file in firefox.
Enjoy :-)
Technical
If you want to change the settings of the game at any time. Open up the source code in a text editor and scroll down to where you see a comment saying "GAME SETTINGS" - read the comments on the right of each setting to understand what it does.
var setting_resolution = 10; //higher number = bigger snake & bigger blocks
var setting_grid_dimentions_x = 700; //width
var setting_grid_dimentions_y = 500; //height
var setting_allow_to_hit_self = false; //do you want to allow your snake to go over its own body?
var setting_show_grid = false; //mainly used for debugging & development reasons - set to false
var setting_snake_speed = 35; //speed of the snake (milli seconds eg 1 second = 1000 miliseconds)
var setting_fixed_tail = false; //ability to keep the snake constantly growing! lol
var setting_snake_starting_size = 2; //ability to keep the snake constantly growing! lol
Source Code
|
Download Source Code
snake.zip ( 0.00Mb )
|
NEVER open a .exe, .bat, .cmd, or other executable file since that is where viruses are likely to live. Please virus scan all files you download.
|
Comments
| Please login to post comments. |
|
|
Looks tight man.
How long did it take you to code this up?
Btw, fancy uploading it somewhere?
I can't be arsed =D. Go lots to do at the moment.
|
|
|
Lol, just change the settings to make the snake slower:
var setting_snake_speed = 35;
change it to
var setting_snake_speed = 100;
and it will be almost 3 times slower ;-)
Kind regards,
Scott
|
More "JavaScript" Source Codes By This Author
Recently Posted "JavaScript" Source Codes
Recently Rated "JavaScript" Source Codes
|