Rust Journey – Snake Clone – Day 6

As I mentioned in my last post, I’ve had some really busy weeks – actually, it’s been busy for months now…

I was still contemplating whether to transition to another project since we had pretty much accomplished all the challenges and goals for this one. But in the end, I decided to continue and incorporate both graphics and sound.

I began by creating a sprite sheet and then proceeded to load the textures. Within just a couple of minutes, I managed to transform the food item rectangle into a sprite, and from there, I updated the snake graphics and later, the wall graphics. I also added a subtle sound effect for when the food item is consumed.

The entire process was fairly straightforward and uncomplicated; the only challenging part was ensuring that some segments’ rotations were correct (e.g., graphics for movements from Left-Top needed to be rotated 180 degrees in comparison to Top-Left movements).

With the project now considered complete, I’ve posted it on You can check it out by clicking here. I’ve also updated the code on its GitHub repository.

I already have a few ideas for my next projects and will be sharing them here soon!

Rust Journey – Snake Clone – Day 5

It’s been some busy weeks for me. So I had to slow down my side projects.

Well, I finished the implementation for highscores. Returning a struct with strings is way harder than I anticipated. I used another approach, fetching the values when needed.

I am not happy with the final implementation, but I can always refactor it when I fully understand the language and its concepts.

Oh, I forgot to mention it in the previous post. I got the debugger running and it was one of my goals.

I also moved the project to Linux. Had a hard time setting up the SFML/CSFML dependencies, but everything went ok after I changed the crate dependency to the rust-sfml git repository.

Final Notes

Well, not much was achieved. But I finally got the highscores working. I am just going to implement graphics and sound and then finally call the project done.

Hope the next iteration happens soon.

Rust Journey – Snake Clone – Day 4

I started this iteration by fixing a few bugs and then proceed to add the screens for the different game states(game over, main menu, high scores). It was a quick and dirty iteration just before calling it a day. But since everything happened within 24 hours I am mentioning it.

Then, I created modules for every screen and improved the code to remove any duplicate code and redundancy. Now every screen module is composed of two main functions: render and handler. The further first dealt with key codes but soon it changed to all events.

I committed my changes and started working with the high scores, both recording the values into a file and also fetching it. I got everything working, except the high score display. Dealing with Strings or str within structs or returning was a mess. I went into many lifetime issues when working with it.

I decided to ditch everything related to the high-scores and start over. No git commit was done.

Final Notes

I like to have small iterations to get something working followed by a refactor, but this time I had to rethink my strategy. I understand the causes of the issues I ran into, but I am still learning the language to know how to deal with it.