Skip to content

Commit b54141a

Browse files
committed
DONE points display works correctly now
1 parent 98ef0d2 commit b54141a

File tree

2 files changed

+22
-16
lines changed

2 files changed

+22
-16
lines changed

game_board/GemCell.gd

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ class_name GemCell
88
@onready var debug_ui_panel:Panel = $DebugUIPanel
99
@onready var audio_gem_explode:AudioStreamPlayer = $AudioGemExplode
1010
@onready var audio_gem_move:AudioStreamPlayer = $AudioGemMove
11+
@onready var label_points:Label = $LabelPoints
1112
# PROPS
1213
const SPRITE_SCALE:Vector2 = Vector2(0.5, 0.5)
1314
const DROP_OFFSET:int = 128 # (the sprite is centered in the 128x128 container, and uses a 64,64 position)
@@ -83,6 +84,7 @@ func play_selected_anim(selected:bool):
8384
else:
8485
anim_player_fx.stop()
8586
sprite.scale = SPRITE_SCALE
87+
label_points.visible = false
8688

8789
# @desc: both AnimPlayer & AnimExplode are 1-sec
8890
func play_anim_explode():
@@ -92,19 +94,21 @@ func play_anim_explode():
9294
# B: explode effect (scale down to zero)
9395
# IMPORTANT: use play/stop or scale wont reset!
9496
anim_player_fx.play("explode")
95-
anim_player_fx.stop()
9697
sprite.visible = false
9798

98-
# D: show points
99+
# C: show points
99100
anim_player_fx.play("new_points")
100101

101-
# C: explode animation (exploding sprite)
102+
# D: explode animation (exploding sprite)
102103
anim_sprite_explode.visible = true
103104
anim_sprite_explode.play("default")
104105
await get_tree().create_timer(Enums.EXPLODE_DELAY).timeout
105-
print(Enums.EXPLODE_DELAY)
106+
107+
# LAST: reset anim-player effects (after await above)
106108
anim_sprite_explode.visible = false
107-
109+
anim_player_fx.stop()
110+
label_points.visible = false # anim_player_fx stop/reset above unhides it
111+
108112
# =========================================================
109113

110114
func debug_show_selnum(num:int):

game_board/gem_cell.tscn

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[gd_scene load_steps=28 format=3 uid="uid://clfnptdc2tu5l"]
1+
[gd_scene load_steps=27 format=3 uid="uid://clfnptdc2tu5l"]
22

33
[ext_resource type="Script" path="res://game_board/GemCell.gd" id="1_rhspx"]
44
[ext_resource type="Texture2D" uid="uid://duau66qew6757" path="res://assets/gems/characters_0001.png" id="2_33s7h"]
@@ -8,7 +8,6 @@
88
[ext_resource type="Theme" uid="uid://hahh0mrfx2q1" path="res://themes/debug_label_theme.tres" id="6_hn3w3"]
99
[ext_resource type="AudioStream" uid="uid://ca0jp78fn0bi1" path="res://assets/audio/bfh1_glass_breaking_02.ogg" id="7_50xdd"]
1010
[ext_resource type="AudioStream" uid="uid://ds53xomd2ha1b" path="res://assets/audio/Abstract2.ogg" id="8_cgn1d"]
11-
[ext_resource type="FontFile" uid="uid://bylgyjavx5yts" path="res://assets/fonts/Quicksand-Regular.ttf" id="9_7eqpv"]
1211

1312
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_lpbyf"]
1413
bg_color = Color(0, 0, 0, 0.533333)
@@ -260,14 +259,16 @@ anchor_right = 1.0
260259
anchor_bottom = 1.0
261260
grow_horizontal = 2
262261
grow_vertical = 2
263-
theme_override_colors/font_color = Color(0, 0, 0, 1)
264-
theme_override_colors/font_shadow_color = Color(0, 0, 0, 1)
262+
theme_override_colors/font_color = Color(0.0745098, 0.0745098, 0.0745098, 1)
263+
theme_override_colors/font_shadow_color = Color(1, 1, 1, 0.411765)
265264
theme_override_colors/font_outline_color = Color(0, 1, 0, 1)
266-
theme_override_constants/outline_size = 5
267-
theme_override_constants/shadow_outline_size = 3
265+
theme_override_constants/shadow_offset_x = 3
266+
theme_override_constants/shadow_offset_y = 3
267+
theme_override_constants/outline_size = 6
268+
theme_override_constants/shadow_outline_size = 6
268269
theme_override_fonts/font = ExtResource("5_lb5dp")
269-
theme_override_font_sizes/font_size = 48
270-
text = "-"
270+
theme_override_font_sizes/font_size = 72
271+
text = "0"
271272
horizontal_alignment = 1
272273
vertical_alignment = 1
273274

@@ -324,17 +325,18 @@ stream = ExtResource("8_cgn1d")
324325
[node name="LabelPoints" type="Label" parent="."]
325326
visible = false
326327
modulate = Color(1, 1, 1, 0)
328+
custom_minimum_size = Vector2(128, 128)
327329
layout_mode = 0
328330
offset_top = -99.0
329331
offset_right = 128.0
330-
offset_bottom = -9.0
332+
offset_bottom = 29.0
331333
theme_override_colors/font_color = Color(1, 1, 1, 1)
332334
theme_override_colors/font_shadow_color = Color(0, 0, 0, 1)
333335
theme_override_colors/font_outline_color = Color(0, 1, 0, 1)
334336
theme_override_constants/shadow_offset_x = 3
335337
theme_override_constants/shadow_offset_y = 3
336-
theme_override_fonts/font = ExtResource("9_7eqpv")
337-
theme_override_font_sizes/font_size = 72
338+
theme_override_fonts/font = ExtResource("5_lb5dp")
339+
theme_override_font_sizes/font_size = 60
338340
text = "+10"
339341
horizontal_alignment = 1
340342
vertical_alignment = 1

0 commit comments

Comments
 (0)