Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Snake code review request  (Read 1236 times)

0 Members and 1 Guest are viewing this topic.

Gaius

  • Newbie
  • *
  • Posts: 11
    • View Profile
Snake code review request
« on: July 31, 2014, 07:12:23 pm »
I've recently finished programming a clone of the popular "Snake" game in C++ with SFML and Visual Studio 12 and I would like to know if there is anything about the code or it's structure that I could improve. This is the second post I've made on this forum, the first was a Pong review request.
 
Game:
 

 
 
Files:
 


 
Code:
 
main.cpp
 
(click to show/hide)

Snake.h
(click to show/hide)

Snake.cpp
(click to show/hide)

Food.h
(click to show/hide)

Food.cpp
(click to show/hide)

Entity.h
(click to show/hide)

Entity.cpp
(click to show/hide)

SoundEffect.h
(click to show/hide)

SoundEffect.cpp
(click to show/hide)

globals.h
(click to show/hide)

Hapax

  • Hero Member
  • *****
  • Posts: 3351
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Snake code review request
« Reply #1 on: August 02, 2014, 01:07:22 am »
Just glanced over main.cpp. I think I'm too tired to give out style tips  ;D

I did noticed that you seem to have forgotten to change the if to an else if in the keypress tests, after the test for Escape.
Also, the section of code that follows //Update should probably be in its own function to make main() a lot more easy to read.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

 

anything