From 02d14e913ca8e2ce7af80f3d0a250b76a69f9d35 Mon Sep 17 00:00:00 2001 From: Henry Date: Sat, 3 Jan 2026 18:08:32 +0000 Subject: [PATCH] Score now briefly pops to a larger size as it increases in value. --- .../UI objects/WINNER (72 x 8).png | Bin 0 -> 338 bytes .../UI objects/WINNER (72 x 8).png.import | 40 ++++++++++++++++++ project.godot | 1 + score_counter.gd | 24 ++++++++--- ui.gd | 4 ++ 5 files changed, 63 insertions(+), 6 deletions(-) create mode 100644 Mini Pixel Pack 3/UI objects/WINNER (72 x 8).png create mode 100644 Mini Pixel Pack 3/UI objects/WINNER (72 x 8).png.import diff --git a/Mini Pixel Pack 3/UI objects/WINNER (72 x 8).png b/Mini Pixel Pack 3/UI objects/WINNER (72 x 8).png new file mode 100644 index 0000000000000000000000000000000000000000..1ff6e70487fbe79b31f0fd1491303fa07401b18a GIT binary patch literal 338 zcmeAS@N?(olHy`uVBq!ia0vp^9ze{&!2~3)Ue~JuQtTz3zOL-g7`X-YSiYR|DNig)WpMX#0UD!FmRh7>tY=c#y5u3qh>`+7cc6?hkj>!LpeYZeSkfJR z9T^xl_H+M9WCilslDyqr82*Fcg1yTpgG5S#{DK+&GWarF-Z_h}0Vp!t)5S5QV$R*k z2YDM5cwBckds}dthnHwRH>^^~%=%sL_;it{uvcSv9rq^v+xot*3Z^Vdo1S>bZ}Itn z3vC|~14C)rb+39@CspKfG` zRt&oscqplTwm$ctjZ2Q6{9N(>c#Lk+gpUtvT^u)DD!cXmyLs=^-Y0Y9YctjUt(eO$ X`s9hn{@1cVXEJ!Y`njxgN@xNA-Y|a{ literal 0 HcmV?d00001 diff --git a/Mini Pixel Pack 3/UI objects/WINNER (72 x 8).png.import b/Mini Pixel Pack 3/UI objects/WINNER (72 x 8).png.import new file mode 100644 index 0000000..5a551d2 --- /dev/null +++ b/Mini Pixel Pack 3/UI objects/WINNER (72 x 8).png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dfbykvik8gknm" +path="res://.godot/imported/WINNER (72 x 8).png-842770cf011d495aed3a3bda96e3b342.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Mini Pixel Pack 3/UI objects/WINNER (72 x 8).png" +dest_files=["res://.godot/imported/WINNER (72 x 8).png-842770cf011d495aed3a3bda96e3b342.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/project.godot b/project.godot index 8503f81..489cca2 100644 --- a/project.godot +++ b/project.godot @@ -11,6 +11,7 @@ config_version=5 [application] config/name="shmup01b" +run/main_scene="uid://cc2dnhuv4qx7m" config/features=PackedStringArray("4.5", "Forward Plus") config/icon="res://icon.svg" diff --git a/score_counter.gd b/score_counter.gd index 214ec7c..80fabe7 100644 --- a/score_counter.gd +++ b/score_counter.gd @@ -1,5 +1,7 @@ extends HBoxContainer +var last_score: String = "00000000" + var digit_coords = { 1: Vector2(0, 0), 2: Vector2(8, 0), @@ -14,11 +16,21 @@ var digit_coords = { } func display_digits(n): + var s = "%08d" % n + var start = 8 - str(n).length() # Finds the starting position of the counter by converting the score to a string, minus the leading zeros. + var changed = false + for i in 8: - get_child(i).texture.region = Rect2(digit_coords[int(s[i])], - Vector2(8, 8)) - # var tween = create_tween() - # tween.tween_property(get_node("HBoxContainer/ScoreCounter/Digit0"), "scale", scale + Vector2(.5,.5), .15) - # await get_tree().create_timer(.25).timeout - # tween.tween_property(get_node("HBoxContainer/ScoreCounter/Digit0"), "scale", scale + Vector2(-.5,-.5), .15) + get_child(i).texture.region = Rect2(digit_coords[int(s[i])], Vector2(8, 8)) + if i >= start and s[i] != last_score[i]: + changed = true + if changed: + for i in 8: + if i >= start: + var tween = create_tween() + tween.tween_property(get_child(i), "scale", Vector2(2,2), .15).set_trans(Tween.TRANS_BOUNCE) + tween.tween_property(get_child(i), "position:y", +5, .15).set_ease(tween.TRANS_QUART) + tween.tween_property(get_child(i), "scale", Vector2(1,1), .15).set_trans(Tween.TRANS_BOUNCE) + tween.tween_property(get_child(i), "position:y", -5, .15).set_ease(tween.TRANS_QUART) + last_score = s diff --git a/ui.gd b/ui.gd index 2ab18e3..30787f3 100644 --- a/ui.gd +++ b/ui.gd @@ -12,6 +12,10 @@ func _ready(): func update_score(value): score_counter.display_digits(value) + # var digits = score_counter.get_children() + # var tween = create_tween() + # tween.tween_property(digits,"scale",2,.15) + func _on_shield_changed(max_value: int, old_value: int, new_value: int) -> void: shield_bar.max_value = max_value