shoDater/scenes/quiz/assets/scripts/gabeSlide.gd

32 lines
768 B
GDScript

extends TextureRect
var slide = false
var exit = false
var originalPosition
func _ready():
position.x = get_viewport_rect().size.x + 500
position.y = get_viewport_rect().size.y - 500
originalPosition = position
func _physics_process(delta):
if slide:
var targetPosition = Vector2.ONE
targetPosition.y = position.y
targetPosition.x = get_viewport_rect().size.x / 2 - 250
position = position.lerp(targetPosition, 5 * delta)
elif exit:
position = position.lerp(originalPosition, 5 * delta)
originalPosition.x = get_viewport_rect().size.x + 500
originalPosition.y = get_viewport_rect().size.y - 500
func _on_dialog_gabe_trigger():
visible = true
slide = true
exit = false
func _on_dialog_gabe_exit():
visible = true
exit = true
slide = false