WaterArea.gd 301 B

12345678910
  1. class_name WaterArea
  2. extends Area2D
  3. @export var max_height := -158
  4. func _physics_process(_delta: float) -> void:
  5. for i in get_tree().get_nodes_in_group("Players"):
  6. if i.global_position.y <= max_height:
  7. i.velocity.y += 20
  8. i.global_position.y = clamp(i.global_position.y, max_height - 4, INF)