ladder working
This commit is contained in:
@@ -1,24 +1,25 @@
|
||||
extends Node3D
|
||||
extends Area3D
|
||||
|
||||
var is_climbing = false
|
||||
var ladder_center
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
ladder_center = self.global_position
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
pass
|
||||
|
||||
|
||||
func _on_area_3d_body_entered(body):
|
||||
func _on_body_entered(body):
|
||||
if body.is_in_group("player"):
|
||||
is_climbing = true
|
||||
body.lader_collide(is_climbing)
|
||||
body.is_climbing = true
|
||||
body.ladder_center = ladder_center
|
||||
|
||||
|
||||
func _on_area_3d_body_exited(body):
|
||||
|
||||
func _on_body_exited(body):
|
||||
if body.is_in_group("player"):
|
||||
is_climbing = false
|
||||
body.lader_collide(is_climbing)
|
||||
body.is_climbing = false
|
||||
body.gravity = body.default_gravity
|
||||
body.ladder_center = null
|
||||
|
||||
Reference in New Issue
Block a user