2D Swimming.. (Godot 3.5)

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

Node2d(renamed temp)
two platforms
(between them)
Area 2D
tilemap (to draw the water)
collisonshape2d (across the top row)
and my character (with script)
so far i got my player to walk on the platforms

what i need help with is when my character hits the water
how do i *check to see if the character is in the water
*move my character while in the water.
here is my character script
please help write code for the

enum States {AIR = 1, FLOOR, LADDER, WALL, }
var state = States.AIR
var velocity = Vector2(0,0)

const GRAVITY = 35
const JUMPFORCE = -1100
const RUNSPEED = 400
const SPEED = 210
const FIREBALL =preload(“res://Scene/Fireball.tscn”)

func _physics_process(delta):
match state:
States.AIR:
if is_on_floor():
state = States.FLOOR
continue

		$Sprite.play("Air")
		if Input.is_action_pressed("Right"):
			velocity.x = lerp(velocity.x,SPEED,0.1) if velocity.x < SPEED else lerp(velocity.x, SPEED, 0.01)
			$Sprite.flip_h = false
		elif Input.is_action_pressed("Left"):
			velocity.x = lerp(velocity.x,-SPEED,0.1) if velocity.x > -SPEED else lerp(velocity.x,-SPEED,0.01)
			$Sprite.flip_h = true
		else:
			velocity.x = lerp(velocity.x,0,0.2)
		move_and_fall()
		fire()
			
	States.FLOOR:
		if not is_on_floor():
			state = States.AIR
			continue
		
				
		if Input.is_action_pressed("Right"):
			if Input.is_action_pressed("run"):
				velocity.x = lerp(velocity.x,RUNSPEED,0.1)
				$Sprite.set_speed_scale(1.8)
			else:
				velocity.x = lerp(velocity.x,SPEED,0.1)
				$Sprite.set_speed_scale(1.0)
			$Sprite.play("Walk")
			$Sprite.flip_h = false
		elif Input.is_action_pressed("Left"):
			if Input.is_action_pressed("run"):
				velocity.x = lerp(velocity.x,-RUNSPEED,0.1)
				$Sprite.set_speed_scale(1.8)
			else:
				velocity.x = -SPEED
				$Sprite.set_speed_scale(1.0)
			$Sprite.play("Walk")
			$Sprite.flip_h = true
		else:
			$Sprite.play("Idle")
			velocity.x = lerp(velocity.x, 0,0.2)
				
		if Input.is_action_just_pressed("Jump"):
			velocity.y = JUMPFORCE
			$SoundJump.play()
			state = States.AIR
			

		move_and_fall()
		fire()

func fire():
if Input.is_action_just_pressed(“fire”):
var direction = 1 if not $Sprite.flip_h else -1
var f = FIREBALL.instance()
f.direction = direction
get_parent().add_child(f)
f.position.y = position.y
f.position.x = position.x + 25 * direction

func move_and_fall():
velocity.y = velocity.y + GRAVITY

velocity = move_and_slide(velocity,Vector2.UP)

func bounce():
velocity.y = JUMPFORCE * 0.7