Nice another Snake clone! :)
I really like the graphic style, although the snake could need a different tile for its head. :P
The game machanics need a bit more tweaking, because fast movement is currently not possible, e.g. pressing Up and Left very quickly one after the other, will result in the Snake going Up.
I quickly took a peak at the code, but didn't analyze it that much. What I saw (https://github.com/Futochu/Serpent/blob/master/main.cpp#L97) is wrong; you should not mix the realtime input class sf::Keyboard and mix it with events. Use on or the other, but not both at the same time for one task. See the official tutorial (http://www.sfml-dev.org/tutorials/2.1/window-events.php#the-keypressed-and-keyreleased-events) in how to correctly handle Event inputs, maybe that will already solve the issue, maybe not - we'll see. ;)
Uhm yeah "music"? :P
Anyways good job for your first project! :)
So basically, instead of
case (sf::Event::KeyPressed):
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Up))
presskey = 1;
else if(sf::Keyboard::isKeyPressed(sf::Keyboard::Down))
presskey = 2;
else if(sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
presskey = 3;
else if(sf::Keyboard::isKeyPressed(sf::Keyboard::Left))
presskey = 4;
break;
You want
case (sf::Event::KeyPressed):
if(event.key.code == sf::Keyboard::Up)
presskey = 1;
else if(event.key.code == sf::Keyboard::Down)
presskey = 2;
else if(event.key.code == sf::Keyboard::Right)
presskey = 3;
else if(event.key.code == sf::Keyboard::Left))
presskey = 4;
break;
?
Also, what do you mean by "fast movement"?
Anyway, all your critiques have been noted and rectified.
New executable Serpent v0.2:
https://www.dropbox.com/s/va74qwwgluha20w/Serpent.exe (https://www.dropbox.com/s/va74qwwgluha20w/Serpent.exe)
New assets:
https://www.dropbox.com/s/zv6d70r8n4uptod/loop.wav (https://www.dropbox.com/s/zv6d70r8n4uptod/loop.wav)
Replaces old loop.wav
https://www.dropbox.com/s/ym2kn0b0ijnjtb3/snakehead.png (https://www.dropbox.com/s/ym2kn0b0ijnjtb3/snakehead.png)
New snake head texture