In my current game, I want part of one of the levels to be an underwater swimming part. What would be the best way to do this? I thought maybe that when you are in the water, the gravity could be lower and it would change to the swimming animation, and when you jump, you float up a bit. Any better ideas?
Thing is you need a floor to push off against when jumping. If you were to do a regular platform swimming bit then the sprite needs to gain height by swimming - not just recycling the jumping animation. If you get my drift, like.
I'm not good at swimming, though I could float a bit. If you want a quick solution, just make the jump strength weaker when jumping in water. If you want a more realistic one, make the jump weaker the deeper the character is in water (check Y position for deepness) down to a minimum jump strength.
No need to bother with anything more advanced
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.