Simple snake clone

Show off your games, demos and other (playable) creations.
Post Reply
User avatar
veethree
Inner party member
Posts: 877
Joined: Sat Dec 10, 2011 7:18 pm

Simple snake clone

Post by veethree »

Decided to write a simple snake clone the other day..this is basically the results. Doesn't have any fancy bloom shaders but it is functional..haha.

I'd love it if someone would look over the code..The way i made the snake may not be the best one..i'd love comments on that.

There's also some bugs..if you find any that i don't know of please let me know!

Bugs i know of:
-When you hit the bottom or right border the warping is a little weird..not too sure what's causing that
-If you're for example going up, then hit the right/left arrow then down really fast the snake collides with himself and you lose.

Controls: WASD or arrow keys. And the mouse in the menu (just click start)

in-game screenshot:
Image

Made for version 0.8.0, May not be compatible with older versions
Attachments
Snake Clone.love
Snake for version 0.8.0
(183.01 KiB) Downloaded 155 times
Santos
Party member
Posts: 384
Joined: Sat Oct 22, 2011 7:37 am

Re: Simple snake clone

Post by Santos »

Storing the grid coordinates instead of the absolute position of the snake's pieces might be something to consider. For example, instead of storing {x = 16, y = 48}, you could store {x = 1, y = 3}. This should make things easier to understand and code.

Also, you might want to avoid using magic numbers. For example, instead of having the number "16" throughout the code, you can set a variable to 16 with a name describing what it really means.

Hope this helps! ^^
Last edited by Santos on Fri Apr 20, 2012 12:12 am, edited 1 time in total.
User avatar
Kadoba
Party member
Posts: 399
Joined: Mon Jan 10, 2011 8:25 am
Location: Oklahoma

Re: Simple snake clone

Post by Kadoba »

Hmm.. this looks familiar :crazy:

By the way, you can keep clicking the start button even after the game starts.
User avatar
veethree
Inner party member
Posts: 877
Joined: Sat Dec 10, 2011 7:18 pm

Re: Simple snake clone

Post by veethree »

Santos wrote:Storing the grid coordinates instead of the absolute position of the snake's pieces might be something to consider. For example, instead of storing {x = 16, y = 48}, you could store {x = 1, y = 3}. This should make things easier to understand and code.

Also, you might want to avoid using magic numbers. For example, instead of having the number "16" throughout the code, you can set a variable to 16 with a name describing what it really means.

Hope this helps! ^^
I do deal with grid coordinates for the "blips" (stuff you pick up). As for the magic number, The grid is all 16x16 cells, So i use 16 for a bunch of things. Anyway i see what you mean, I'll have a look at that.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest