On Monday evening February 10th with the the loss of a certain ‘Flappy’ game still fresh in everyone’s mind, I saw several tweets swirling about how little time it would take to make or how few lines of code are in such games. (Random question. What is the genre officially? I default to ‘copter’ game since that is the earliest game I can remember)
I decided that I would spend one night on a random concept to see if was as easy to make as I perceived it to be. (Even the simplest of concepts inevitably take more time than expected).
Why make Sharky Fish?
I wanted to release something small and free to the Play Store to see how the process works. The concept of a little fish dodging sharks and the border of the screen seemed straight forward to program and I knew that the art would not take long to draw and to animate. I am currently splitting time between two larger projects that will take many more months to complete and I wanted to see something be completed and I needed to switch gears for a couple days to refresh. Perfect timing for a random solo game jam!
As I mentioned, I have been working with LibGDX for a few months now and have a solid understanding of the framework. I created a new project and started implementing a basic UI. I had some code that I wrote to render buttons and textures at different resolutions, but most of the game was written from scratch. I brought the UI code into the project and designed the buttons and banners in photoshop in about one hour. For the next hour I created the shark and fish images and brought them into Spine. (Spine is a 2d skeletal animation program that is totally amazing).
Instead of creating sprite sheets, I thought it would be easier to create animations with spine. One awesome feature in spine is the ability to assign arbitrary polygons to your animation and then import into your game. Here are the bounds I assigned to the animations in the game.
I used the LibGDX spine runtime to import the animations and perform collision detection. I used the LibGDX Intersector helper class. The only trick here was to use the computeWorldVertices method on the BoundingBoxAttachment read in from the skeleton. This sets the vertices to world space in relation to a bone and x, y coordinate. Then the Intersector can be used to detect if one Polygon overlaps another with the overlapConvexPolygons method. That was really all I had to do for collision!
Things that saved me time:
- Used LibGDX Stage to handle different display resolutions
- Used existing UI framework for buttons and input
- Used spine to animate instead of making sprite sheets
The Break Down
So I went about 2 hours beyond my original 8 hour estimate. Here is how I spent the time.
Development Hours: 5
Art and animation: 3
Lines of Code: ~1500
Can I play it?
Sharky Fish can be found on the play store here
Edited – 2/16/2014
I decided to remove Sharky Fish from the Play Store because I think it makes more sense to post as a web game. I used Libgdx and GWT to render an HTML5 version of the game.
Check it out here: http://www.dreamwagon.com/sharkyfish
I would be happy to share the entire source for this game upon request. (tweet me @dreamwagon)