My biggest takeaway in my GGJ17 experience was implementing a ‘sprite sheet animation‘-selector based on a given angle. This is only applicable to 2D games with more than 2 views per animation. If you haven’t read about our game from my last post, you can get more info here.
Here are the requirements:
- Surfers could go be going to the right, down right, down, down left, or left
- Dolphins could go left, up left, up, up right, right
- Tiki could point left, up left, up, up right, and right
Each of these directions is a sprite sheet/sequence animation. The solution:
- Each direction is a game object that animates through the sprite sheet/sequence
- These direction game objects are children of a selector game object
- The criteria of the selector is based on an absolute direction (to a target object, mouse, etc)
- The selector activates the direction closest to the criteria and deactivates all others
If the directions weren’t animations (like the Tiki pointing), then a simple sprite selector based on angle would be enough.
A public repo of the project can also be found here. Here’s a UnityPackage of the demo: