score label vfx; increase building collider size
This commit is contained in:
parent
69faf54dc3
commit
962c4cb469
6 changed files with 60 additions and 18 deletions
|
|
@ -64,13 +64,6 @@ mesh = SubResource("SphereMesh_4flbx")
|
|||
[node name="PlayerHUD" type="CanvasLayer" parent="." unique_id=1676328708]
|
||||
script = ExtResource("2_g6k8r")
|
||||
|
||||
[node name="ScoreLabel" type="Label" parent="PlayerHUD" unique_id=1108751125]
|
||||
offset_right = 40.0
|
||||
offset_bottom = 23.0
|
||||
theme_override_font_sizes/font_size = 48
|
||||
text = "Score: %s"
|
||||
script = ExtResource("2_onrkg")
|
||||
|
||||
[node name="HealthLabel" type="Label" parent="PlayerHUD" unique_id=1653322479]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
|
|
@ -119,6 +112,30 @@ theme_override_font_sizes/font_size = 32
|
|||
text = "BasicGun"
|
||||
horizontal_alignment = 2
|
||||
|
||||
[node name="Score" type="Control" parent="PlayerHUD" unique_id=1241180984]
|
||||
layout_mode = 3
|
||||
anchors_preset = 5
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
grow_horizontal = 2
|
||||
script = ExtResource("2_onrkg")
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="ScoreText" type="Label" parent="PlayerHUD/Score" unique_id=1108751125]
|
||||
custom_minimum_size = Vector2(1152, 0)
|
||||
layout_mode = 1
|
||||
anchors_preset = 5
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
offset_left = -576.0
|
||||
offset_right = 576.0
|
||||
offset_bottom = 132.0
|
||||
grow_horizontal = 2
|
||||
theme_override_constants/outline_size = 31
|
||||
theme_override_font_sizes/font_size = 96
|
||||
text = "14"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Guns" type="Node3D" parent="." unique_id=2018109083]
|
||||
|
||||
[node name="Sharpshooter" type="Node3D" parent="Guns" unique_id=1677055720]
|
||||
|
|
|
|||
|
|
@ -1,12 +1,35 @@
|
|||
extends Label
|
||||
extends Control
|
||||
|
||||
const DESIRED_SCALE := Vector2.ONE * .5
|
||||
|
||||
@onready var label: Label = get_child(0)
|
||||
var tween: Tween
|
||||
var _display_score := 0
|
||||
var score := 0:
|
||||
set(v):
|
||||
var delta = abs(v - score)
|
||||
score = v
|
||||
text = "Score: %d" % v
|
||||
|
||||
if label != null:
|
||||
if tween != null: tween.stop()
|
||||
tween = create_tween()
|
||||
tween.tween_method((func(n):
|
||||
_display_score = n
|
||||
label.text = str(n)
|
||||
), _display_score, score, .25)
|
||||
|
||||
scale += Vector2.ONE * pow(delta, 1.25) / 400
|
||||
|
||||
func exp_lerp(a: Variant, b: Variant, decay: float, dt: float) -> Variant:
|
||||
return lerp(a, b, 1 - exp(-decay * dt))
|
||||
|
||||
func _ready() -> void:
|
||||
scale = DESIRED_SCALE
|
||||
score = score
|
||||
SignalBus.building_destroyed.connect(func(_building):
|
||||
score += 10
|
||||
SignalBus.building_destroyed.connect(func(_building, increment):
|
||||
score += increment
|
||||
)
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
scale = exp_lerp(scale, DESIRED_SCALE, 05, delta)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue