- Home /
Underwater playable area for 2D platformer
Hi all,
I am creating a 2D platformer where the player is surfing the water but falls underwater when he hits an obstacle. My question is, what is the most optimal way to make sure that the player stays underwater (detecting play area which is underwater) since gravity as such will be removed and the player can just swim out of the water into the sky.
TIA!
@$$anonymous$$dOfAnEmpire Why do you want to prevent the player from going above-water again? Aren't they already self-motivated to keep diving again because that's where you gave them the goal of finding the equipment? Also, do they have limited air as part of the challenge, and what happens if they die? And is it appropriate in your game design to have a wall be above them (e.g. the ceiling of a flooded cave, or the below of a ship), which would create a natural hard collision zone? Lacking any of that, you could have a cubic trigger zone on top (a collider but set to be a trigger) which would, with strength proportional to one's vertical height, lower one's upward velocity.
I guess the way I worded my question was off. The player can swim up. But at the same time, he shouldn't be allowed to swim down further than a certain depth.
Your answer