Page 1 of 3

simple snake

Posted: Fri May 06, 2011 4:28 pm
by bmzz
This is my first LOVE game. A simple snake game.

controls:
Up, down, left and right arrow keys.
Pause is 'p'.
If you died, press 'Enter' to restart.

Download

Enjoy.

Re: simple snake

Posted: Fri May 06, 2011 5:03 pm
by knorke
worked nicely.
but after dying it should maybe still display the score?
now to make it a real game with levels, multiplayer and all that ;)

Re: simple snake

Posted: Fri May 06, 2011 6:53 pm
by Lafolie
This is awesome. Well done.

It's an amazing example of the kind of thing new Löve developers should be doing for their first project. Just brilliant. It seems to cover all the basics including drawing primitives, text, using colour, updating, taking input and it's even got a little highscore tracking system. Fantastic man.

My criticism would be that the player seems to move a bit too slowly.

Re: simple snake

Posted: Fri May 06, 2011 6:59 pm
by bmzz
Hi knorke,

you are right, i should always show the score. I have modified snake.love for it.
Thank you for your idea, i will think about them.

Re: simple snake

Posted: Fri May 06, 2011 8:11 pm
by bmzz
Hi Lafolie,

I am greatly flattered by your evaluation.I just a LOVE/lua newbie...

Anyway, Thank you very much.

Re: simple snake

Posted: Fri May 06, 2011 9:41 pm
by bartbes
Yeah, I agree with Lafolie on the speed, I didn't really get far in the game, though I spent a good 2 minutes playing it, making it faster should make it more fun.

Re: simple snake

Posted: Sat May 07, 2011 1:17 am
by bmzz
i'm have no idea about speed.

i adjust speed from 0.04(sec per block) to 0.02, maybe it will be better.0.015 is the fastest on my pc.

Re: simple snake

Posted: Sat May 07, 2011 6:09 am
by Lafolie
bmzz wrote:i'm have no idea about speed.

i adjust speed from 0.04(sec per block) to 0.02, maybe it will be better.0.015 is the fastest on my pc.
You use the value dt which is passed down through love.update. Basically, you should do:

Code: Select all

time_based_value * dt
I took the time to edit your code and implement dt rather than the manual os.time() comparison you were making. The result is much smoother. If you want to adjust the speed, do so moderately, using small values, e.g. speed = 2 will be slightly slower, speed = 0.5 will be slightly faster. I personally feel that 0.75 - 1 work quite well.

I also added a conf.lua based on your current setup and changed the window size. I felt that the speed of the snake (even updated) was too low to justify such a huge window. Unless you have a huuuuge score you may have to travel an extreme distance, which isn't much fun. I used conf.lua to specify the window dimensions and adjusted your code to read the window size.

Oh, and I added in a little surprise. I have a good reason for doing that, but I hope it helps introduce you to another Löve module. :nyu:

Re: simple snake

Posted: Sat May 07, 2011 5:00 pm
by bmzz
Lafolie wrote:
bmzz wrote:i'm have no idea about speed.

i adjust speed from 0.04(sec per block) to 0.02, maybe it will be better.0.015 is the fastest on my pc.
You use the value dt which is passed down through love.update. Basically, you should do:

Code: Select all

time_based_value * dt
I took the time to edit your code and implement dt rather than the manual os.time() comparison you were making. The result is much smoother. If you want to adjust the speed, do so moderately, using small values, e.g. speed = 2 will be slightly slower, speed = 0.5 will be slightly faster. I personally feel that 0.75 - 1 work quite well.

I also added a conf.lua based on your current setup and changed the window size. I felt that the speed of the snake (even updated) was too low to justify such a huge window. Unless you have a huuuuge score you may have to travel an extreme distance, which isn't much fun. I used conf.lua to specify the window dimensions and adjusted your code to read the window size.

Oh, and I added in a little surprise. I have a good reason for doing that, but I hope it helps introduce you to another Löve module. :nyu:
Thank you.

I learned a lot from you. =)

Re: simple snake

Posted: Sat May 07, 2011 5:03 pm
by Lafolie
It's cool man. I learned some stuff from your code too man. 's all good! :neko:
Hate to say but that's what the rep button is for, heh.