shoDater/scenes/global/assets/scripts/shounicSlide.gd

32 lines
774 B
GDScript3
Raw Permalink Normal View History

2024-07-19 01:26:40 +01:00
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_shounic_trigger():
visible = true
exit = false
slide = true
func _on_dialog_shounic_exit():
visible = true
exit = true
slide = false