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:
Made for version 0.8.0, May not be compatible with older versions
Simple snake clone
Simple snake clone
- Attachments
-
- Snake Clone.love
- Snake for version 0.8.0
- (183.01 KiB) Downloaded 155 times
Re: Simple snake clone
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!
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.
Re: Simple snake clone
Hmm.. this looks familiar
By the way, you can keep clicking the start button even after the game starts.
By the way, you can keep clicking the start button even after the game starts.
Re: Simple snake clone
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.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!
Who is online
Users browsing this forum: No registered users and 3 guests