Inspiration

I was inspired from playing games like pacman when I was younger. This lead me to use my abilities and recreate something similar to pacman, which I call the "Snake Game."

What it does

This is a java FX GUI program where you can play the Snake game. The objective of the game is to increase your score of how many enemies the snake ate. This in turn increases the snakes length. In order to allow the snake to move, the user must use the keyboard's arrow keys, and to restart the game you must press the spacebar key. Moreover, to end the game the user must collide the snake with itself or close the console.

How we built it

I built this game using Java FX, JFrame, and java GUI. Two classes were created, the main class, and the game class. The purpose of the main class was to create the user interface. A JFrame and Game object was created. I also set the bounds, configured the frames behavior when the user closes the game and called the game class. The Game class's purpose is to actually add components that will run the game. Hence, why it has most of the game's code.

Challenges we ran into

Initially I had some challenges on how to make the snake move via the keyboard. I did not know about event listeners and with further research was able to use it efficiently. I also had some challenges learning about java fx as it is something new to me. After doing a lot of learning, I was able to figure it out and complete the project.

Accomplishments that we're proud of

I am really proud of myself to step out of my comfort zone and take part in my first ever hackathon as a total beginner. I wanted to see if this field was something I would be interested in before applying to university. I have taken computer science courses but this hackathon allowed me to use those skills in a very cool and practical manner. So I am really proud I was able to finish my project and participate in this amazing event.

What we learned

Since this was my first hackathon project this was a totally new experience for me. I learned a lot about java and different ways to build gui. I also learned about event listeners something that was a totally new concept for me. I learned that computer science is something that I am definitely interested in for a career. Overall, I really enjoyed the entire experience.

What's next for Snake Game

We can improve this game by adding more levels and features, and adding various themes. It would also be great if this game was hosted onto a website so that it can be enjoyed by everyone.

Built With

Share this project:

Updates