Posted July 03, 2022 by Kottler
I implemented a gameover screen when you don't land on a lilypad and i also made some changes to the detection of the lilypads because the last idea was not that good.
Regarding the landing, now instead of checking triggers, i do a OverlapCircle (raycast) every time the frog lands to check if there is a lilypad collision.
This are the changes on the scripts:
Now the frogs updates it's status to check if it's in a safe position and to update the parent object situation.
If the frog is jumping it should remove it's last parent once, so i have a 'shouldSetParent' in dragAndShoot that is set to true twice. One when the jump starts and one when the jump ends, because it may land on a lilypad and should set it's parent.
Here is how the 'shouldSetParent' changes in dragAndShoot.
I don't love how the scripts ended because there might be some mixed logics and responsabilities here. I'll work on this again in the future for a better solution. Feel free to share what do you think about this.
I have a GameManager object/scripts that deals with the end of the game.
And i added a canvas with a blackground and a 'GameOver' text that it's enabled when the frog is not a in safe spot.
This is the result: