1
Fork 0
mirror of https://github.com/Steffo99/nanogolf.git synced 2024-11-24 09:04:19 +00:00

Add player name and color for golf ball

This commit is contained in:
Steffo 2024-02-19 05:41:04 +01:00
parent 4ff4d8b689
commit 9a2097a207
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0
2 changed files with 34 additions and 1 deletions

View file

@ -25,6 +25,24 @@ var in_hole: bool = false
@onready var putt_controller: PuttController = $"PuttController"
@onready var hole_controller: HoleController = $"HoleController"
@onready var hole_sound: AudioStreamPlayer2D = $"HoleSound"
@onready var player_label: Label = $"PlayerLabel"
## The name of the player represented by this scene.
var player_name: String = "Player":
get:
return player_name
set(value):
player_name = value
player_label.text = value
## The color of the player represented by this scene.
var player_color: Color = Color.WHITE:
get:
return player_color
set(value):
player_color = value
modulate = value
func _on_putt(putt_vector: Vector2):

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=10 format=3 uid="uid://ca06elq8io5wu"]
[gd_scene load_steps=11 format=3 uid="uid://ca06elq8io5wu"]
[ext_resource type="Script" path="res://scenes/golf_ball.gd" id="1_1uswk"]
[ext_resource type="Texture2D" uid="uid://bxyy3bwt7a5l2" path="res://sprites/circle.svg" id="2_mqlag"]
@ -6,6 +6,7 @@
[ext_resource type="PackedScene" uid="uid://cj15ash4r3i4v" path="res://scenes/collision_sound.tscn" id="4_6m2yp"]
[ext_resource type="PackedScene" uid="uid://bf0a04t4b1wil" path="res://scenes/hole_controller.tscn" id="5_tdklt"]
[ext_resource type="AudioStream" uid="uid://crfybmbv6dbs4" path="res://sounds/hole.wav" id="6_08dpq"]
[ext_resource type="Theme" uid="uid://mau3moiintkp" path="res://themes/nanogolf_theme.tres" id="7_2tupu"]
[sub_resource type="Curve" id="Curve_v81ms"]
min_value = -20.0
@ -49,4 +50,18 @@ debug_color = Color(0, 0.701961, 0.141176, 0.419608)
[node name="HoleSound" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("6_08dpq")
[node name="PlayerLabel" type="Label" parent="."]
anchors_preset = 4
anchor_top = 0.5
anchor_bottom = 0.5
offset_left = 8.0
offset_top = -11.5
offset_right = 48.0
offset_bottom = 11.5
grow_vertical = 2
theme = ExtResource("7_2tupu")
theme_override_font_sizes/font_size = 13
text = "Player"
vertical_alignment = 1
[connection signal="putt" from="PuttController" to="." method="_on_putt"]