• Home
  • About
    • Bryce Newell photo

      Bryce Newell

      Here I will be writing my developer diary and will showcase some of the projects that i am working on.

    • Learn More
    • Github
  • Posts
    • All Posts
    • All Tags
  • Projects

Snake Game

08 Nov 2017

Reading time ~1 minute

What was the project?

The aim of this project was to create our own version of the classic snake game using the ASGE engine in c++.

I aimed to create a feeling of nostalgia/retro in my game, with a similar theme to the original game with a black background and green snake.

What were the issues?

The main issue when making this game, was how to spawn ever more snake bodies when the player collects fruit. I overcame this issue by using a vector of snake bodies. You can see the function which does this in the code below:

void SnakeHead::addTail(ASGE::Renderer * renderer)
{
		SnakeBody* newBody = new SnakeBody();
		newBody->init(renderer);
		sb.push_back(newBody);
}

Though this seems like a small feat, it is the first time I’ve used vectors.

What I thought was good

I think that the overall feel of the game is good, the controls feel responsive and there is no lag between input and action. The snapping to grid also works almost perfectly which is something I was worried about to start with

What would I have done differently?

One thing which I was not happy with about my code is the lack of OOP features. Though I have extrapolated certain things into functions, there are still lots of code in the base functions.

The final product

Here is the final product in GIF form. If you would like the files to this project, please feel free to contact me at: brycenewell@icloud.com

https://gyazo.com/7e9916c98c057949a7505a5e8ba823d6



projectc++development Share Tweet +1