26 lines
532 B
GDScript
26 lines
532 B
GDScript
extends AnimatableBody3D
|
|
|
|
@onready var start_position:Vector3 = position
|
|
var risen:bool = false
|
|
var raiser : Tween
|
|
|
|
func raise(body) -> void:
|
|
if body is not PlayerController:
|
|
push_warning("Unexpected body in raiser trigger", body)
|
|
return
|
|
|
|
if risen:
|
|
position = start_position
|
|
|
|
if raiser and raiser.is_valid():
|
|
raiser.kill()
|
|
|
|
raiser = create_tween()
|
|
raiser.tween_property(self, "position", start_position + Vector3(0,1.1,0), 1)
|
|
risen = true
|
|
|
|
|
|
func reset(_discard) -> void:
|
|
risen = false
|
|
position = start_position
|