Files
fps_project_1/scripts/ladder.gd
2025-01-17 16:04:03 -06:00

25 lines
585 B
GDScript

extends Area3D
@onready var collision_midpoint: Node3D = $CollisionMidpoint
# Called when the node enters the scene tree for the first time.
func _ready():
pass
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func _on_body_entered(body):
if body.is_in_group("player"):
body.is_climbing = true
if body.global_position.y < collision_midpoint.global_position.y:
body.global_position.y += .2
func _on_body_exited(body):
if body.is_in_group("player"):
body.is_climbing = false
body.gravity = body.default_gravity