## simple snake

Show off your games, demos and other (playable) creations.
bmzz
Prole
Posts: 16
Joined: Fri May 06, 2011 9:21 am

### simple snake

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.

Enjoy.
Attachments
snake.png (29.45 KiB) Viewed 2380 times
Last edited by bmzz on Sat May 07, 2011 1:31 am, edited 4 times in total.

knorke
Prole
Posts: 46
Joined: Wed Jul 14, 2010 7:06 pm
Contact:

### Re: simple snake

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

Lafolie
Inner party member
Posts: 804
Joined: Tue Apr 05, 2011 2:59 pm
Location: SR388
Contact:

### Re: simple snake

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.
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.

bmzz
Prole
Posts: 16
Joined: Fri May 06, 2011 9:21 am

### Re: simple snake

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.

bmzz
Prole
Posts: 16
Joined: Fri May 06, 2011 9:21 am

### Re: simple snake

Hi Lafolie,

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

Anyway, Thank you very much.

bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

### Re: simple snake

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.

bmzz
Prole
Posts: 16
Joined: Fri May 06, 2011 9:21 am

### Re: simple snake

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.

Lafolie
Inner party member
Posts: 804
Joined: Tue Apr 05, 2011 2:59 pm
Location: SR388
Contact:

### Re: simple snake

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.
Attachments
snake_dt_audio.love
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.

bmzz
Prole
Posts: 16
Joined: Fri May 06, 2011 9:21 am

### Re: simple snake

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.
Thank you.

I learned a lot from you. =)

Lafolie
Inner party member
Posts: 804
Joined: Tue Apr 05, 2011 2:59 pm
Location: SR388
Contact:

### Re: simple snake

It's cool man. I learned some stuff from your code too man. 's all good!
Hate to say but that's what the rep button is for, heh.
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.

### Who is online

Users browsing this forum: No registered users and 5 guests