I was able to make a simple water effect thru photoshop, but what is the C# script code to make the water rise and when player reach the water they die and game over? How to do a platform type in Unity? I am creating a 2D game where a player jump thru each blocks like Doodle Jump and the water is rising and when the player get to the water, then game over. ,I was able to create a simple water effect thru photoshop, but what is a simple C# script to make the water rise and when a player get to the water, they die and game over? How to do a platform type in unity?
1 Answer
1Make a gameObject in your scene put your water sprite on it and a box collider, set the collider to trigger, use a script to scale the y of the gameObject, use a lerp or coroutine to ping pong the value, or add randomness if wanted, this will scale the sprite and collider. Use OnTriggerEnter2D and call the game over from there.
you can just move the gameObject rather than stretch it, just make sure it's tall enough, you can raise it over time using a coroutine or just from the update.
– logicandchaos