Add score for ball exchange
This commit is contained in:
parent
582a39992c
commit
40525022d7
BIN
art/fonts/DraftingMono-Regular.ttf
Normal file
BIN
art/fonts/DraftingMono-Regular.ttf
Normal file
Binary file not shown.
33
art/fonts/DraftingMono-Regular.ttf.import
Normal file
33
art/fonts/DraftingMono-Regular.ttf.import
Normal file
|
@ -0,0 +1,33 @@
|
|||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://8guv2d1fgna7"
|
||||
path="res://.godot/imported/DraftingMono-Regular.ttf-2613f107ee7cfa148009be1dfb779785.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://art/fonts/DraftingMono-Regular.ttf"
|
||||
dest_files=["res://.godot/imported/DraftingMono-Regular.ttf-2613f107ee7cfa148009be1dfb779785.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=1
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
18
scenes/hud.tscn
Normal file
18
scenes/hud.tscn
Normal file
|
@ -0,0 +1,18 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://bxj8v34v1igyc"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/hud.gd" id="1_glf76"]
|
||||
[ext_resource type="FontFile" uid="uid://8guv2d1fgna7" path="res://art/fonts/DraftingMono-Regular.ttf" id="1_xr1ih"]
|
||||
|
||||
[node name="HUD" type="CanvasLayer"]
|
||||
script = ExtResource("1_glf76")
|
||||
|
||||
[node name="ScoreLabel" type="Label" parent="."]
|
||||
anchors_preset = 1
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
offset_left = -60.0
|
||||
offset_bottom = 41.0
|
||||
grow_horizontal = 0
|
||||
theme_override_fonts/font = ExtResource("1_xr1ih")
|
||||
theme_override_font_sizes/font_size = 30
|
||||
text = "0"
|
|
@ -1,11 +1,14 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://cdwgmtyq2y8sm"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://cdwgmtyq2y8sm"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/main.gd" id="1_1xo8b"]
|
||||
[ext_resource type="PackedScene" uid="uid://m8uyi35gr3qd" path="res://scenes/tile_map.tscn" id="2_c6bkg"]
|
||||
[ext_resource type="PackedScene" uid="uid://ba1t35yyot4jl" path="res://scenes/player.tscn" id="2_idv37"]
|
||||
[ext_resource type="PackedScene" uid="uid://bktg1ypaav3q3" path="res://scenes/enemy.tscn" id="3_2xcd4"]
|
||||
[ext_resource type="PackedScene" uid="uid://bxj8v34v1igyc" path="res://scenes/hud.tscn" id="4_ealqo"]
|
||||
|
||||
[node name="Main" type="Node2D"]
|
||||
y_sort_enabled = true
|
||||
script = ExtResource("1_1xo8b")
|
||||
|
||||
[node name="TileMap" parent="." instance=ExtResource("2_c6bkg")]
|
||||
position = Vector2(324, 82)
|
||||
|
@ -19,3 +22,7 @@ position = Vector2(0, 40)
|
|||
z_index = 1
|
||||
z_as_relative = false
|
||||
y_sort_enabled = true
|
||||
|
||||
[node name="HUD" parent="." instance=ExtResource("4_ealqo")]
|
||||
|
||||
[connection signal="hit_ball" from="TileMap/Player" to="." method="_on_player_hit_ball"]
|
||||
|
|
4
scripts/hud.gd
Normal file
4
scripts/hud.gd
Normal file
|
@ -0,0 +1,4 @@
|
|||
extends CanvasLayer
|
||||
|
||||
func update_score(score):
|
||||
$ScoreLabel.text = str(score)
|
7
scripts/main.gd
Normal file
7
scripts/main.gd
Normal file
|
@ -0,0 +1,7 @@
|
|||
extends Node2D
|
||||
|
||||
var score = 0
|
||||
|
||||
func _on_player_hit_ball():
|
||||
score += 1
|
||||
$HUD.update_score(score)
|
Loading…
Reference in a new issue