Easter Break Development

Adding Tweens

To ease me back into development over the Easter break, I decided to add some visual polish to the game via tweening. Tweens are essentially smooth animated transitions between any two values in the game. They are usually done for things like UI sliding into place, or a character squashing and stretching when landing and jumping.

For this I used the PrimeTween package, which essentially has the same features of popular packages such as DOTween but automatically takes care of things like memory management in a much more efficient way, making it a very easy choice to simply drop straight into the project.

The first script I changed to test it is the RoomTrigger script, which fades in and out the name of any new room the player enters. Before, the code to do this was a very long-winded couroutine which used a timer.

With PrimeTween, all this code could be replaced by a simple sequence:

This perhaps wasnt entirely necessary but taught me all the essentials of using the plugin. After this, I added a tween to the camera’s script so the player smoothly transitions to a higher FOV when sprinting.

Leave a Reply

Your email address will not be published. Required fields are marked *