Unity 2D space shooter – retractable wing animation

Cosmosis, the original shmup for iOS

I created my first 2D space shooter (shmup) called Cosmosis in Objective-C using cocos2d-iphone a few years back. The game didn’t feature much with regard to individual sprite animation though. Since recently getting acquainted with Unity3D, I decided to recreate Cosmosis using this excellent tool. This decision was even easier after seeing the 2D features of Unity launch a few months back.

Being quite well into re-development of my shmup, this post covers a small update. I have been working on a new feature (when compared with the original Cosmosis game), specifically retracting and extending wings that can fire “dumb” rockets.

Unity and the 2D toolset for animation

Having had to learn to use Unity’s animation and state machine system, I must say it is very comprehensive. I still have much to learn, but so far I have managed to grasp some of the basics of the system.

The base player ship and gun mount are graphics courtesy of Dan Cook (lostgarden.com). I didn’t have the retracting and extending wings, so I created these myself using Photoshop. This was a simple case of drawing the basic shape with the polygon selection tool, followed by adding a few layers for detail. Using the brush tool, I added the content and colour. I was also careful to match the colours to the original player ship graphic.

The original player graphic with a gun mounted is show below on the left. On the right is the player with newly created wings/rocketpods extended.

original-player-with-gunmount       player-swingarms


Finally, here is the animation system in action. When the fire button is pressed the wings extend and fire rockets. Let go of the fire button, and the wings retract again. You will also notice the small gun mount in the middle of the player’s ship. This has a short recoil animation which loops when the player is using the primary “gun” weapon. The primary gun fires a simple blue coloured projectile.


Leave a Comment