some combo text effect
This commit is contained in:
parent
43a63dbe91
commit
607973c2ac
@ -49,9 +49,10 @@ _coin_label = NodePath("UI/CoinLabel")
|
||||
[node name="Soundtrack" type="AudioStreamPlayer" parent="."]
|
||||
bus = &"Music"
|
||||
|
||||
[node name="UI" type="CanvasLayer" parent="." node_paths=PackedStringArray("_combo_timer")]
|
||||
[node name="UI" type="CanvasLayer" parent="." node_paths=PackedStringArray("_combo_timer", "_combo_label")]
|
||||
script = ExtResource("3_p340v")
|
||||
_combo_timer = NodePath("ComboTimer")
|
||||
_combo_label = NodePath("Combo")
|
||||
|
||||
[node name="ChatPanel" type="Panel" parent="UI"]
|
||||
visible = false
|
||||
@ -145,23 +146,6 @@ layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="Combo" type="Label" parent="UI"]
|
||||
visible = false
|
||||
self_modulate = Color(0.534784, 0.97046, 3.46541e-06, 1)
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -20.0
|
||||
offset_top = -11.5
|
||||
offset_right = 20.0
|
||||
offset_bottom = 11.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 4
|
||||
text = "+5!"
|
||||
|
||||
[node name="ComboTimer" type="Timer" parent="UI"]
|
||||
wait_time = 3.0
|
||||
one_shot = true
|
||||
@ -175,6 +159,15 @@ offset_bottom = 40.0
|
||||
theme_override_constants/outline_size = 6
|
||||
text = "Coins: 0"
|
||||
|
||||
[node name="Combo" type="RichTextLabel" parent="UI"]
|
||||
clip_contents = false
|
||||
offset_left = 16.0
|
||||
offset_top = 32.0
|
||||
offset_right = 192.0
|
||||
offset_bottom = 56.0
|
||||
theme_override_colors/default_color = Color(0.695503, 0.695503, 0.695503, 1)
|
||||
theme_override_constants/outline_size = 6
|
||||
|
||||
[node name="CSGBox3D" type="CSGBox3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 7.45058e-09, 0)
|
||||
collision_mask = 0
|
||||
|
@ -1,8 +1,17 @@
|
||||
extends CanvasLayer
|
||||
|
||||
@export var _combo_timer: Timer
|
||||
@export var _combo_label: RichTextLabel
|
||||
|
||||
var _id: int
|
||||
var _last_combo_time: float
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
var blend := Color(0.2, 0.2, 0.2, (Time.get_ticks_msec() - _last_combo_time) / 3000)
|
||||
var color := Color.GOLD.blend(blend)
|
||||
_combo_label.add_theme_color_override("default_color", color)
|
||||
_combo_label.self_modulate = Color(1, 1, 1,
|
||||
clamp(1 - (Time.get_ticks_msec() - _last_combo_time) / 3000, 0, 1))
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
@ -14,6 +23,7 @@ func _ready() -> void:
|
||||
else:
|
||||
$Combo.show()
|
||||
$Combo.text = "+" + str(current) + "!"
|
||||
_last_combo_time = Time.get_ticks_msec()
|
||||
_combo_timer.start()
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user