challenge-editor/scene/start_the_game.gd

52 lines
1.6 KiB
GDScript3
Raw Normal View History

2024-09-10 10:19:15 +08:00
extends Control
var target = null:
set(value):
target = value
var tween = get_tree().create_tween()
tween.set_loops()
tween.tween_property($TextureRect2, "global_position", target.global_position + Vector2(-90, target.size.y/2 - 42/2), 0.1)
tween.parallel()
tween.tween_property($TextureRect3, "global_position", target.global_position + Vector2(target.size.x+90, target.size.y/2 - 42/2), 0.1)
#$TextureRect2.global_position = target.global_position + Vector2(0, target.size.y/2)
#$TextureRect3.global_position = target.global_position + Vector2(target.size.x, target.size.y/2)
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
#var tween = get_tree().create_tween()
#tween.set_loops()
#tween.tween_property($TextureRect2, "scale", Vector2(1,0), 0.4)
#tween.parallel()
#tween.tween_property($TextureRect3, "scale", Vector2(-1,0), 0.4)
#
#tween.tween_property($TextureRect2, "scale", Vector2(1,1), 0.4)
#tween.parallel()
#tween.tween_property($TextureRect3, "scale", Vector2(-1,1), 0.4)
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
$TextureRect2.visible = target != null
$TextureRect3.visible = target != null
pass
func _on_button_mouse_entered() -> void:
target = %Button
pass # Replace with function body.
func _on_button_2_mouse_entered() -> void:
target = %Button2
pass # Replace with function body.
func _on_button_3_mouse_entered() -> void:
target = %Button3
pass # Replace with function body.
func _on_button_4_mouse_entered() -> void:
target = %Button4
pass # Replace with function body.