Posts Tagged ‘source code’

Sprite Code for Unity and Desktop Photo

Posted by (twitter: @Local_Minimum)
Friday, December 13th, 2013 7:47 am

Unity 2D Sprite Animation

I spent the warmup weekend cursing the collision detection in the new 2D mode in Unity for several hours until I realized that there was a new OnCollisionEnter2D. Makes sense, but lesson learned: know your tool before starting. I would have been so frustrated if those hours had been tomorrow afternoon, that I don’t know what would have happened.

After that debacle, I made a Unity2D Sprite Animation Script that I think turned out pretty nice and easy to use. Probably there are better and more efficient out there, but since we’ll probably use it, it needs to be available. So here you go. If you want to use it, consider it public domain.

Short instructions: Use Unity’s sprite editor to break up sprite sheet(s) into sprites. Then add one SpriteAnimator per type of animation you want on your game object (e.g. ‘walk left’, ‘walk right’).
Add one SpriteAnimationSelector to the game object with the SpriteAnimator(s). The CharacterController is not a full controller by any means, but it shows how to interface with the SpriteAnimationSelector.

Finally, this is where we’ll code, more computers are coming:

The living room game making table of the turmeric jam jar.

The living room game making table of the turmeric jam jar.

And here’s where we’ll try our luck with using stop-motion in making the game:

The animation corner of the turmeric jam jar.

The animation corner of the turmeric jam jar.


All from our living room.

[cache: storing page]