Combined timer and health UI
Rather than having mutliple UI components for showing the timer before the hero arrives and the heros health once he is there, I moved the health and timer UI components into the same region of the canvas and updated the show and hide animations so they appear in order.
This is done using using MMFeedbacks which is an old free library for adding game feel by reuno, but there is also new and maintained version in the Asset Store which comes with lots of support and demos, so go check that out!
Essentially I hide everything by setting the x and y transform scale to 0, then I have a scale effect that scales everything to 1 to show or 0 to hide along a bouncy curve to add to the fun.
Then I have several scripts and events that trigger hiding and showing when required.
public class HealthController : MonoBehaviour { [SerializeField] private MMFeedbacks _showFeedbacks; private void ShowHealth() { if (_showFeedbacks) { _showFeedbacks.PlayFeedbacks(); } } private void OnEnable() { HeroEvents.OnHeroEntered += ShowHealth; } private void OnDisable() { HeroEvents.OnHeroEntered -= ShowHealth; } }
Its a bit more complicated than that, but you get the idea...
Want to see more?
All the code for this project is available publicly online.
- Game code - https://gitlab.com/LPGames/gdfg-jam-6/-/tree/master/Assets
- Assets:
- Kings and Pigs by Pixel Frog - https://pixelfrog-assets.itch.io/kings-and-pigs
- Kenney.nl Platformer Pack Medieval - https://kenney.nl/assets/platformer-pack-medieval
Get Tower Offender
Tower Offender
You are the bad guy... Figure it out!
Status | In development |
Authors | yanniboi, FinchInSpace, Raziel8 |
Genre | Platformer |
Tags | Tower Defense |
More posts
- Simple dialogue systemJun 19, 2021
- Zelda style heart animationJun 19, 2021
Leave a comment
Log in with itch.io to leave a comment.