Add label under the lilypad
This commit is contained in:
@@ -13,14 +13,28 @@ var top_to_bottom: bool = false
|
||||
|
||||
@onready var animation_player: AnimationPlayer = $AnimationPlayer
|
||||
@onready var button: TextureButton = $TextureButton
|
||||
@onready var label: Label = %Label
|
||||
@onready var label: Label = $TextureButton/TextBox_Sprite2D/PercentMarginContainer/AspectRatioContainer/AutoSizeLabel/Label
|
||||
@onready var highlight_fx: HighlightFX = %HighlightFX
|
||||
@onready var right_fx: RightFX = %RightFX
|
||||
@onready var wrong_fx: WrongFX = %WrongFX
|
||||
@onready var text_box_sprite_2d: Sprite2D = %TextBox_Sprite2D
|
||||
|
||||
|
||||
func disappear() -> void:
|
||||
button.set_disabled(true)
|
||||
var tween: Tween = create_tween()
|
||||
tween.parallel().tween_property(
|
||||
label,
|
||||
"self_modulate:a",
|
||||
0.0,
|
||||
0.5
|
||||
)
|
||||
tween.parallel().tween_property(
|
||||
text_box_sprite_2d,
|
||||
"self_modulate:a",
|
||||
0.0,
|
||||
0.5
|
||||
)
|
||||
animation_player.play("disappear")
|
||||
|
||||
|
||||
@@ -30,11 +44,17 @@ func highlight() -> void:
|
||||
|
||||
|
||||
func right() -> void:
|
||||
label.label_settings = label.label_settings.duplicate()
|
||||
label.label_settings.font_color = Minigame.LABEL_COLOR_NEUTRAL
|
||||
text_box_sprite_2d.self_modulate = Minigame.LABEL_COLOR_WIN
|
||||
right_fx.play()
|
||||
await right_fx.finished
|
||||
|
||||
|
||||
func wrong() -> void:
|
||||
label.label_settings = label.label_settings.duplicate()
|
||||
label.label_settings.font_color = Minigame.LABEL_COLOR_NEUTRAL
|
||||
text_box_sprite_2d.self_modulate = Minigame.LABEL_COLOR_LOSE
|
||||
wrong_fx.play()
|
||||
await wrong_fx.finished
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=11 format=3 uid="uid://bkswcqcmf7a0r"]
|
||||
[gd_scene load_steps=14 format=3 uid="uid://bkswcqcmf7a0r"]
|
||||
|
||||
[ext_resource type="Material" uid="uid://3n8kdc1u25om" path="res://sources/minigames/frog/lilypad_material.tres" id="1_pbo2v"]
|
||||
[ext_resource type="Script" uid="uid://cbr7ejw51u38r" path="res://sources/minigames/frog/lilypad.gd" id="2_pdqed"]
|
||||
@@ -6,7 +6,10 @@
|
||||
[ext_resource type="PackedScene" uid="uid://cge0uyn30tcpv" path="res://sources/utils/fx/highlight.tscn" id="5_1llgv"]
|
||||
[ext_resource type="PackedScene" uid="uid://cn2rw06pltyiu" path="res://sources/utils/fx/right.tscn" id="6_wslmk"]
|
||||
[ext_resource type="PackedScene" uid="uid://dlmbxcgiv8tpr" path="res://sources/utils/fx/wrong.tscn" id="7_241b6"]
|
||||
[ext_resource type="Texture2D" uid="uid://c34sgkbvr3h8q" path="res://assets/minigames/minigame_ui/graphic/primary_text_box.png" id="7_o8d8g"]
|
||||
[ext_resource type="LabelSettings" uid="uid://bguqnhiblwick" path="res://resources/themes/minigames_label_settings.tres" id="8_4pqhl"]
|
||||
[ext_resource type="Script" uid="uid://d5qkkg88431w" path="res://sources/utils/percent_margin_container.gd" id="8_osqfu"]
|
||||
[ext_resource type="PackedScene" uid="uid://bgio7muqck2bu" path="res://sources/utils/auto_size_label.tscn" id="9_r5oc0"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_852sr"]
|
||||
length = 0.001
|
||||
@@ -22,18 +25,6 @@ tracks/0/keys = {
|
||||
"update": 0,
|
||||
"values": [0.0]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Label:modulate")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_qb6cr"]
|
||||
resource_name = "disappear"
|
||||
@@ -50,18 +41,6 @@ tracks/0/keys = {
|
||||
"update": 0,
|
||||
"values": [0.0, 1.0]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Label:modulate")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.5),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_3tohd"]
|
||||
_data = {
|
||||
@@ -138,26 +117,45 @@ position = Vector2(150, -42)
|
||||
|
||||
[node name="BottomVisibleOnScreenNotifier" type="VisibleOnScreenNotifier2D" parent="TextureButton"]
|
||||
unique_name_in_owner = true
|
||||
position = Vector2(150, 342)
|
||||
position = Vector2(150, 406)
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
[node name="TextBox_Sprite2D" type="Sprite2D" parent="TextureButton"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 1
|
||||
position = Vector2(150, 330)
|
||||
scale = Vector2(0.471, 0.471)
|
||||
texture = ExtResource("7_o8d8g")
|
||||
|
||||
[node name="PercentMarginContainer" type="Container" parent="TextureButton/TextBox_Sprite2D"]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -150.0
|
||||
offset_top = -150.0
|
||||
offset_right = 150.0
|
||||
offset_bottom = 111.0
|
||||
offset_left = -297.0
|
||||
offset_top = -114.5
|
||||
offset_right = -297.0
|
||||
offset_bottom = -114.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
text = "ent"
|
||||
script = ExtResource("8_osqfu")
|
||||
margin_left_ratio = 0.2
|
||||
margin_top_ratio = 0.1
|
||||
margin_right_ratio = 0.2
|
||||
margin_bottom_ratio = 0.2
|
||||
|
||||
[node name="AspectRatioContainer" type="AspectRatioContainer" parent="TextureButton/TextBox_Sprite2D/PercentMarginContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="AutoSizeLabel" parent="TextureButton/TextBox_Sprite2D/PercentMarginContainer/AspectRatioContainer" instance=ExtResource("9_r5oc0")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" parent="TextureButton/TextBox_Sprite2D/PercentMarginContainer/AspectRatioContainer/AutoSizeLabel" index="0"]
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
text = ""
|
||||
label_settings = ExtResource("8_4pqhl")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[connection signal="animation_finished" from="AnimationPlayer" to="." method="_on_animation_player_animation_finished"]
|
||||
[connection signal="pressed" from="TextureButton" to="." method="_on_texture_button_pressed"]
|
||||
[connection signal="screen_exited" from="TextureButton/TopVisibleOnScreenNotifier" to="." method="_on_top_visible_on_screen_notifier_screen_exited"]
|
||||
[connection signal="screen_exited" from="TextureButton/BottomVisibleOnScreenNotifier" to="." method="_on_bottom_visible_on_screen_notifier_screen_exited"]
|
||||
|
||||
[editable path="TextureButton/TextBox_Sprite2D/PercentMarginContainer/AspectRatioContainer/AutoSizeLabel"]
|
||||
|
||||
@@ -94,7 +94,7 @@ func _spawn_lilypad() -> void:
|
||||
else:
|
||||
lilypad.global_position = global_position + Vector2(size.x / 2.0, size.y)
|
||||
|
||||
lilypad_size = lilypad.button.size
|
||||
lilypad_size = lilypad.button.size + Vector2(0, lilypad.label.size.y)
|
||||
if size.x < lilypad_size.x:
|
||||
var lily_scale: float = size.x / lilypad_size.x
|
||||
lilypad.button.scale = Vector2(lily_scale, lily_scale)
|
||||
|
||||
Reference in New Issue
Block a user