Snake Pong is my first game, written in Actionscript 3 with the Flixel game engine. The concept itself is simple to understand, though beating it is significantly harder. Here I share some of the thought processes that went into making the game, as well as a personal reflection of the journey.
In Snake Pong, the player controls a snake moving across the screen, with the goal of collecting all the bricks(or foods) while keeping the ball from dropping off the bottom of the screen.
The core challenge is that bricks located near the top are riskier and harder to get at because the player will have less reaction time as he moves to the top. One possible strategy would be to first collect the low hanging fruits, i.e., bricks near the bottom. This increases the length of the snake and improves survivability when going for the higher bricks.
The ball drops vertically at the start of the screen, with no horizontal velocity at all. As you can probably imagine, having zero horiontal velocity permanently would probably make for a really boring game. (Unless…hmmmm…) To introduce a horizontal coomponent in the ball velocity, in some implementations of Breakout, the paddle is “curved”. The further away from the middle of the paddle the ball hits, the greater the horizontal velocity it gains. (When the ball strikes the exact middle of the paddle, it will bounce straight up.)
In Snake Pong, I introduced this horizontal component through a kind of “friction” instead. When the ball hits a part of the snake which is moving left or right, it will increase the horizontal velocity of the ball in that direction. Therefore if the player keeps hitting the ball when he is moving left, the ball will eventually be too fast for him to catch up. Winning requires a sort of balancing act.
If you’re impatient or reckless in this game, you will not win.
I went through a Flixel tutorial by chipacabra to get started, ignoring parts I didn’t need for my game to speed up the process. It uses an older version of Flixel, so things were a little tricky at times. But it was quite a good learning opportunity as it forced me to look at the actual source code to figure out what has changed.
From a technical point of view, it’s not much of an achievement. But personally for a beginner like me, the game meant the overcoming a considerable number of obstacles.
I posted Snake Pong on Kongregate so that my girlfriend could play it (Which she then went on to beat rather quickly.) When I checked back in the next day, I was pleasantly surprised and super stoked to find that FIVE people had commented on my game. Most of them were essentially suggestions to make the game easier. They were all constructive, which was amazing. Receiving feedback, whether they’re positive or negative, is an amazing feeling. It shows that someone actually gives a damn.
I included a mute toggle at the suggestion of one of the commenters, and made some tweaks to make the game slightly easier.
Things I accomplished:
- Got started and familiar with the Flixel engine
- Learnt how to read and use code other people have written
- Tried a few tilemap editors (DAME still feels very frustrating to use)
- Messed around with Pixen (Think MS Paint, but with layers like Photoshop.)
- Drew a pixel art circle.
- Gained a better understanding of OOP a litte better (I kind of know the basics, but applying the principles is really difficult. I found this article by photonstorm really useful though.)
- Improved bug-finding-and-squashing skills
Things I could have done better:
- Add a preloader screen
- Added more levels (Perhaps transition to an regular snake game at the end?)
- Made the game jucier?
Onwards, to the next game. Do try the game here if you haven’t already!