38 lines
1.0 KiB
GDScript3
38 lines
1.0 KiB
GDScript3
|
extends TextureRect
|
||
|
var slide = false
|
||
|
var exit = false
|
||
|
var originalPosition = Vector2.ONE
|
||
|
|
||
|
func _ready():
|
||
|
visible = false
|
||
|
originalPosition.x = get_viewport_rect().size.x / 2 + 100
|
||
|
originalPosition.y = get_viewport_rect().size.y - 325
|
||
|
|
||
|
func _physics_process(delta):
|
||
|
if slide:
|
||
|
show_behind_parent = false
|
||
|
visible = true
|
||
|
var targetPosition = Vector2.ONE
|
||
|
targetPosition.y = originalPosition.y - 150
|
||
|
targetPosition.x = originalPosition.x + 150
|
||
|
global_position = global_position.lerp(targetPosition, 5 * delta)
|
||
|
elif exit:
|
||
|
show_behind_parent = true
|
||
|
global_position = global_position.lerp(originalPosition, 5 * delta)
|
||
|
originalPosition.x = get_viewport_rect().size.x / 2 + 100
|
||
|
originalPosition.y = get_viewport_rect().size.y - 325
|
||
|
else:
|
||
|
originalPosition.x = get_viewport_rect().size.x / 2 + 100
|
||
|
originalPosition.y = get_viewport_rect().size.y - 325
|
||
|
|
||
|
func _on_dialog_sho_phone_exit():
|
||
|
visible = true
|
||
|
exit = true
|
||
|
slide = false
|
||
|
|
||
|
|
||
|
func _on_dialog_sho_phone_trigger():
|
||
|
visible = true
|
||
|
exit = false
|
||
|
slide = true
|