save system

This commit is contained in:
zoe 2021-10-01 16:23:48 +02:00
parent ad8de1dbb7
commit ffcccb8c2e
29 changed files with 286 additions and 77 deletions

View file

@ -1,7 +1,10 @@
[gd_scene load_steps=3 format=2]
[gd_scene load_steps=6 format=2]
[ext_resource path="res://Ball/sprite.png" type="Texture" id=1]
[ext_resource path="res://HUD/BallCounter.gd" type="Script" id=2]
[ext_resource path="res://HUD/Multiplier.gd" type="Script" id=3]
[ext_resource path="res://Menu/Theme.tres" type="Theme" id=4]
[ext_resource path="res://HUD/Score.gd" type="Script" id=5]
[node name="HUD" type="CanvasLayer"]
@ -19,3 +22,33 @@ centered = false
region_enabled = true
region_rect = Rect2( 0, 0, 16, 16 )
script = ExtResource( 2 )
[node name="Multiplier" type="Label" parent="."]
margin_left = 336.0
margin_top = 176.0
margin_right = 376.0
margin_bottom = 190.0
grow_horizontal = 0
grow_vertical = 0
theme = ExtResource( 4 )
text = "x 1"
align = 2
script = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Score" type="Label" parent="."]
margin_left = 336.0
margin_top = 192.0
margin_right = 376.0
margin_bottom = 210.0
grow_horizontal = 0
grow_vertical = 0
theme = ExtResource( 4 )
text = "500"
align = 2
script = ExtResource( 5 )
__meta__ = {
"_edit_use_anchors_": false
}

1
HUD/HighScoreLabel.gd Normal file
View file

@ -0,0 +1 @@
extends Label

7
HUD/Multiplier.gd Normal file
View file

@ -0,0 +1,7 @@
extends Label
func _ready():
var _connected = GameStats.connect("multiplier_changed", self, "update_text")
func update_text(value):
text = "x" + String(value)

8
HUD/Score.gd Normal file
View file

@ -0,0 +1,8 @@
extends Label
func _ready():
update_text(GameStats.score)
var _connected = GameStats.connect("score_changed", self, "update_text")
func update_text(value):
text = String(value)