As everyone knows, we are in summer!
Regarding Everhood, the development will maintain the same rhythm as before.
Working on Everhood is rewarding! So why take some vacation!?
We are currently finishing the last big parts of the game, we will soon enter the polishment phase. Sadly this is all I can say, who wants a spoiler, right?
So to compensate that here is a mini-tutorial on how to make 2d water mask effect.
2D Water mask effect mini tutorial (unity)
For this mini-tutorial, I’m going to break it in 2 parts, how do this effect work and the implementation.
As his name says, the water mask effect uses a SpriteMask that gets activated when the player enters the water and deactivated when the player exit the water.
As you can see, the gif entirely describes how does the effect work.
Water mask setup
First of all, create an empty gameobject named “Player” with a BoxCollider2D component, then add a child named “Visuals” and a SpriteRenderer component to it with a sprite of your character assigned.
After that, let's add another child named “Water Mask”:
and a SpriteMask component to it :
Now the water mask need to affect player spriteRenderer, so let’s click the child “Visuals” to access our spriteRenderer component and set Mask Interaction to Visible outside Mask:
And to finish the water mask setup, adjust the child mask size:
Trigger water mask setup
Now we need to trigger the water mask, for that, create a gameobject “Water” add a spriteRenderer component to it, assign a square sprite and adjust color and size to make it look like water.
Then, let’s add a box collider 2D to it with IsTrigger set to true and a script that executes a UnityEvent on OnTriggerEnter2D and OnTriggerExit2D, finally, hook up waterMask.setActive(true) to OnTriggerEnter2D and waterMask.setActive(false) for OnTriggerExit2D:
Now that you have the basics on how to create a water mask, you can improve it by adjusting the trigger zone, adding particle fx, modifying player movement speed and much more!
Wishlist us here so you don't miss any news:
Leave a comment
Log in with itch.io to leave a comment.