A Touch of Polish
Our coin boxes work, but they could be a bit more polished. We have obvious feedback that the player has successfully struck a box, with the color changing and the coin popping out, but how about adding a little “bump” animation as well so that it feels like we’re really hitting it with some force? We’ll do this by creating a small animation.
Creating a Bump Animation
Thankfully, our disabled coin box is under another GameObject so we can just use a Transform curve to make it bounce. Let’s get it going with the following steps:
1. Select the boxCoin_disabled Prefab.
2. Click the Add Component button and select Miscellaneous > Animator.
3. Create a new Animator Controller named “Block” in the _animations folder of the Project ...
Get Learning 2D Game Development with Unity®: A Hands-On Guide to Game Creation now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.