anyone able to help me solve this issue

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Nofool

the general Idea

hey guys as you can see I uploaded a picture ive been trying to work on this issue for ages now dont get me wrong its possibly simple however im generally new to programming and I have a feeling that im just repeating the same solutions over and over in my head and getting no where.

basically I want to create and endless runner . simple enough but I want the player to have a jumping and diving motion rather than a move and stay dodge mechanic I always want my character to return to the base line.

say they are swimming on the top of the water (baseline) they can press jump to jump out of the water but gravity pulls them back down. or if they dive under water they need to come back up for air.

im not sure anymore where to start and I bet if i could just forget everything ive tried Id probably be able to work it out. if anyone has any ideas on how they would go about doing this it would be great thank you.

:bust_in_silhouette: Reply From: BraindeadBZH

An Area2D allows you to change the gravity vector locally. So what I would do is to create an area which represents the water where gravity is inverted.