Coin counter fix

This commit is contained in:
2024-10-26 11:45:49 +02:00
parent 9f62134048
commit 81debcd2fa
6 changed files with 56 additions and 40 deletions

Binary file not shown.

Binary file not shown.

View File

@ -9,7 +9,7 @@ custom_features=""
export_filter="all_resources" export_filter="all_resources"
include_filter="" include_filter=""
exclude_filter="" exclude_filter=""
export_path="Exports/FirstPlatformer.exe" export_path="Exports/FirstPlatformer_V1_2.exe"
encryption_include_filters="" encryption_include_filters=""
encryption_exclude_filters="" encryption_exclude_filters=""
encrypt_pck=false encrypt_pck=false

View File

@ -99,6 +99,45 @@ animations = [{
[sub_resource type="CircleShape2D" id="CircleShape2D_xb7vb"] [sub_resource type="CircleShape2D" id="CircleShape2D_xb7vb"]
radius = 4.12311 radius = 4.12311
[sub_resource type="Animation" id="Animation_gjsx2"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("AnimatedSprite2D:visible")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("CollisionShape2D:disabled")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("pickupsound:playing")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
[sub_resource type="Animation" id="Animation_iyw47"] [sub_resource type="Animation" id="Animation_iyw47"]
resource_name = "pickup" resource_name = "pickup"
tracks/0/type = "value" tracks/0/type = "value"
@ -152,45 +191,6 @@ tracks/3/keys = {
}] }]
} }
[sub_resource type="Animation" id="Animation_gjsx2"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("AnimatedSprite2D:visible")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("CollisionShape2D:disabled")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("pickupsound:playing")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_ln4ma"] [sub_resource type="AnimationLibrary" id="AnimationLibrary_ln4ma"]
_data = { _data = {
"RESET": SubResource("Animation_gjsx2"), "RESET": SubResource("Animation_gjsx2"),

View File

@ -337,3 +337,17 @@ scale = Vector2(1, 1.12)
theme_override_fonts/font = ExtResource("7_jqhk7") theme_override_fonts/font = ExtResource("7_jqhk7")
theme_override_font_sizes/font_size = 8 theme_override_font_sizes/font_size = 8
text = "Made with <3 by Kilokem" text = "Made with <3 by Kilokem"
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="Label2" type="Label" parent="CanvasLayer"]
offset_left = 739.0
offset_top = 608.0
offset_right = 1231.0
offset_bottom = 659.0
scale = Vector2(1, 1.12)
theme_override_fonts/font = ExtResource("7_jqhk7")
theme_override_font_sizes/font_size = 24
text = "Collected coins: 0🟡"
vertical_alignment = 3
autowrap_mode = 2

View File

@ -3,11 +3,13 @@ extends Node
var score = 0 var score = 0
@onready var label: Label = $Label @onready var label: Label = $Label
@onready var onscreen_label: Label = $"../CanvasLayer/Label2"
func add_point(): func add_point():
score += 1 score += 1
label.text = "Coins: " + str(score) label.text = "Coins: " + str(score)
onscreen_label.text = "Collected coins: " + str(score) + "🟡"
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready() -> void: func _ready() -> void: