Page 1 of 6

Love for zombies

Posted: Fri Nov 04, 2011 2:31 pm
by Ellohir
I made this little game and I thought I'd share it here. WASD to control the player, left click to shoot, right click to reload. Select Handgun or Machinegun with keys 1 and 2. You must be standing still to change weapons. Kill and survive as long as you can.
fvQLS.png
fvQLS.png (87.35 KiB) Viewed 975 times
GuJXO.png
GuJXO.png (122.18 KiB) Viewed 975 times
2AmRu.png
2AmRu.png (118.24 KiB) Viewed 975 times

Feel free to read the code and / or comment anything you want ;)

You can fork this project at: https://github.com/Ellohir-noldo/Love-for-zombies

Re: Love for zombies

Posted: Fri Nov 04, 2011 2:45 pm
by headchant
Quite a nice little game.

After a few restarts the sounds crashed and the game started acting weirdly. You might get that under control by using the the BDSM(http://love2d.org/forums/viewtopic.php?f=5&t=3804) or some other kind of sound manager.

Re: Love for zombies

Posted: Fri Nov 04, 2011 3:07 pm
by Ellohir
Ouch, yes, I forgot to stop the sound on restart so background sound is stacking with itself. I've fixed it. Thank you very much ^^

Re: Love for zombies

Posted: Fri Nov 04, 2011 4:05 pm
by Larsii30
I love zombie games :)
It's a nice one. May some little tweaks:

+ Add a delay at weapon reloading so the player have to wait may 0,5 - 1,5 sec
+ Sometimes zombies appear very near behind the player (backward movement), so thats a bit "unfair".
+ Let zombies move in different speed, this add some more action instead of stress but at something like the same difficulty.

But I enjoy playing it, and thats the most important thing.
Keep up your work !

edit: oh and I dont know why, but your .love is very big o.o May need some compression of the sound files :)
edit 2: and clever players just hold the right mouse button. Maybe you change this so it is not possible :)
Greets

Re: Love for zombies

Posted: Fri Nov 04, 2011 4:36 pm
by josefnpat
This is super cool.

A few suggestions:
  1. I see you have a maps folder. More maps? I take it this is a given though.
  2. Instead of showing the number of bullets left, maybe show the actual number, and then "RELOAD" when you're empty.
  3. When you start the game, you automatically shoot a bullet.
  4. When it says game over, the "you" 's are not capitalized. Since the rest of the game is capitalized, maybe capitalize them too?
  5. Looking at your code, zombies come at a consistent rate of 1zombie/0.8seconds. Perhaps make more come over time, or get them to come in bigger and bigger waves?
  6. The grass is very repetitive. Consider having multiple grass types and stitching them together?
  7. I can see the player, the cursor and the bullet amount in the main screen. Maybe make them entirely different scenes?
  8. I agree with Larsii30 on the sound size. Doing a du -h * on /sound, I get:
    1.5M bgm.wav
    1.2M death.wav
    12K empty.wav
    172K kill.wav
    44K reload.wav
    24K shot.wav
    4.9M storm.mp3
    bgm.wav and death.wav are far too raw, and could easily be reduced.
    As for storm.mp3, it is 254 seconds of "storm" when you could easily just use the first 30 seconds, loop it, and still get a nice thunder sound in there. It could also be easily reduced.
A few compliments:
  1. I like how you pause everything when the game is not in focus. Very nice.
  2. The main screen and the game over screen are awesome.
  3. Persistent high score
  4. Very clean and well organized code
  5. Pretty damn perfect font choice
  6. The controls are very simple and natural. Movement is also rather natural.
Enhancements:
  1. Different zombies with differen amounts of health and speed?
  2. Multiple guns?
  3. Multi-player?
edit: Thanks bartbes

Re: Love for zombies

Posted: Fri Nov 04, 2011 6:36 pm
by Ellohir
Thanks for the feedback!
Larsii30 wrote: + Add a delay at weapon reloading so the player have to wait may 0,5 - 1,5 sec
+ Sometimes zombies appear very near behind the player (backward movement), so thats a bit "unfair".
+ Let zombies move in different speed, this add some more action instead of stress but at something like the same difficulty.
I already have a "not-spawning" area around the player, seems like it was too little. I made it bigger, shouldn't happen now.
Added the reloading delay and zombie different speed. I've tried it and it makes it much more fun! Thanks for the suggestion.

josefnpat wrote: [*] I see you have a maps folder. More maps? I take it this is a given though.
[*] The grass is very repetitive. Consider having multiple grass types and stitching them together?
Yes, this was in mind when coding. It should be easy to get a bigger spritesheet and to make more maps. The thing is, without a collision system maps are now just background image. Maybe I'll add some support for tile-collision and maze maps, but that would mean programming some zombie IA too so I don't think about it right now.
josefnpat wrote: [*] Instead of showing the number of bullets left, maybe show the actual number, and then "RELOAD" when you're empty.
[*] When you start the game, you automatically shoot a bullet.
[*] When it says game over, the "you" 's are not capitalized. Since the rest of the game is capitalized, maybe capitalize them too?
I didn't understand what you ment with "the actual number" but I made the count of bullets blink when empty xD Fixed the select+shoot problem and the capitalization.
josefnpat wrote: [*] Looking at your code, zombies come at a consistent rate of 1zombie/0.8seconds. Perhaps make more come over time, or get them to come in bigger and bigger waves?
[*] I can see the player, the cursor and the bullet amount in the main screen. Maybe make them entirely different scenes?
I thought about it but when I was playing I already found it hard to survive with a constant spawn rate xD I'll think about it but I don't see it necessary right now.

I like viewing the scene behing the menu. That's why it's semitransparent, so that when I hit "Start" I know what the scene is and what does the player look like. I also like the cursor to be the same on the menu and the game. I removed the bullet indicator, that wasn't a nice detail.
josefnpat wrote: [*] I agree with Larsii30 on the sound size. Doing a du -h * on /sound, I get:
1.5M bgm.wav
1.2M death.wav
12K empty.wav
172K kill.wav
44K reload.wav
24K shot.wav
4.9M storm.mp3
bgm.wav and death.wav are far too raw, and could easily be reduced.
As for storm.mp3, it is 254 seconds of "storm" when you could easily just use the first 30 seconds, loop it, and still get a nice thunder sound in there. It could also be easily reduced.
Yeah, this is a must. I've been using some default free sounds because I don't have a sound editor installed, but it's top on the priority list.
josefnpat wrote: Enhancements:
[*] Different zombies with differen amounts of health and speed?
[*] Multiple guns?
[*] Multi-player?
I definately have to add a shotgun. Every zombie game needs a shotgun xD I don't know about the rest.


Thanks again for your feedback ;)

Re: Love for zombies

Posted: Fri Nov 04, 2011 6:48 pm
by josefnpat
0 bullets: RELOAD
1 bullet: Image
2 bullets: ImageImage
3 bullets:ImageImageImage
...
8 bullets: ImageImageImageImageImageImageImageImage

Re: Love for zombies

Posted: Fri Nov 04, 2011 7:26 pm
by Larsii30
Ellohir wrote: The thing is, without a collision system maps are now just background image.
Set up some tiles und give them ID's. i.e dirt,grass,sand = 0 (player could walk on them without any problems) - water,sump,mud = 1 (player could walk on with slower movement speed) and wall,box, and whatever = 3 ( player can't walk on ). So may you dont need a collsion, just a function that returns the tile the player is on (or is about to going on).

here are the compressed audio files, still a bit big but much better. I compressed them using audacity with .ogg codec, love2d is able to play them. May better then other compressions. you have to change the names in you code to .ogg.
Edit: aaand i've shorted the storm.ogg ! Way to large just for a storm :D You should loop it.
audio.zip
(1.45 MiB) Downloaded 726 times
greets!

Re: Love for zombies

Posted: Fri Nov 04, 2011 7:53 pm
by Ellohir
josefnpat wrote:0 bullets: RELOAD
1 bullet: Image
2 bullets: ImageImage
3 bullets:ImageImageImage
...
8 bullets: ImageImageImageImageImageImageImageImage
Much more visual. I love it. I should have thought of that before xD Modified.
Larsii30 wrote:Set up some tiles und give them ID's. i.e dirt,grass,sand = 0 (player could walk on them without any problems) - water,sump,mud = 1 (player could walk on with slower movement speed) and wall,box, and whatever = 3 ( player can't walk on ). So may you dont need a collsion, just a function that returns the tile the player is on (or is about to going on).
Good idea, I'll see what I can do.

Thanks for the modified audio, I've replaced it ^^

So here is version 1.03, five times lighter than the others and... yes, probably the last of today xD
Thanks for the help Larsii30 and Josefnpat, I really appreciate it ;)

Re: Love for zombies

Posted: Fri Nov 04, 2011 8:03 pm
by josefnpat
Noticed another bug. Highscores don't allow for caps and sillykeys like capslock go bananas.

This is what I do in yalt.

Keep in mind this is hack-and-slash from my own code, so it might not work "out of the box"

Code: Select all

key_disable = { --keys to disable in case they are not in use.
  "up","down","left","right","home","end","pageup","pagedown",--Navigation keys
  "insert","tab","clear","delete",--Editing keys
  "f1","f2","f3","f4","f5","f6","f7","f8","f9","f10","f11","f12","f13","f14","f15",--Function keys
  "numlock","scrollock","ralt","lalt","rmeta","lmeta","lsuper","rsuper","mode","compose",--Modifier keys
  "pause","escape","help","print","sysreq","break","menu","power","euro","undo"--Miscellaneous keys
}
key_capslock = false
key_shift = false
key_ctrl = false

function love.keypressed(key,unicode)
      if key == "backspace" then -- remove last character
        --do your stuff
      elseif key == "rshift" or key == "lshift" then -- enable shift
        key_shift = true
      elseif key == "capslock" then -- enable capslock
        key_capslock = true
      elseif key == "lctrl" or key == "rctrl" then -- enable ctrl
        -- This does not account for someone who pushes both ctrl keys.
        -- Who does that anyway?
        key_ctrl = true
      elseif in_table(key_disable,key) then -- do nothing, this key is disabled.
      else
        --do your stuff
      end
end

function in_table(t,s)
  for i,v in pairs(t) do
    if (v==s) then 
      return true
    end
  end
end