mirror of
https://github.com/Steffo99/nanogolf.git
synced 2024-11-24 09:04:19 +00:00
Add some levels
This commit is contained in:
parent
3acbd84bc3
commit
87ca3c651b
15 changed files with 155 additions and 37 deletions
|
@ -49,6 +49,7 @@ func _on_multiplayer_connected_to_server() -> void:
|
||||||
|
|
||||||
func _on_multiplayer_disconnected_from_server() -> void:
|
func _on_multiplayer_disconnected_from_server() -> void:
|
||||||
Log.peer(self, "Disconnected from server.")
|
Log.peer(self, "Disconnected from server.")
|
||||||
|
lost_connection.emit()
|
||||||
|
|
||||||
func _on_multiplayer_connection_failed() -> void:
|
func _on_multiplayer_connection_failed() -> void:
|
||||||
Log.peer(self, "Connection failed...")
|
Log.peer(self, "Connection failed...")
|
||||||
|
@ -68,7 +69,9 @@ func _on_multiplayer_peer_connected(peer_id: int) -> void:
|
||||||
|
|
||||||
func _on_multiplayer_peer_disconnected(peer_id: int) -> void:
|
func _on_multiplayer_peer_disconnected(peer_id: int) -> void:
|
||||||
Log.peer(self, "Peer disconnected: %d" % peer_id)
|
Log.peer(self, "Peer disconnected: %d" % peer_id)
|
||||||
if is_multiplayer_authority():
|
if peer_id == 1:
|
||||||
|
lost_connection.emit()
|
||||||
|
elif is_multiplayer_authority():
|
||||||
for playernode in player_dir.get_children():
|
for playernode in player_dir.get_children():
|
||||||
if playernode.get_multiplayer_authority() == peer_id:
|
if playernode.get_multiplayer_authority() == peer_id:
|
||||||
player_dir.rpc_possess_playernode.rpc(playernode.player_name, 1)
|
player_dir.rpc_possess_playernode.rpc(playernode.player_name, 1)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=10 format=3 uid="uid://dyxwp5rnxiff7"]
|
[gd_scene load_steps=12 format=3 uid="uid://dyxwp5rnxiff7"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://scenes/game.gd" id="1_cdtng"]
|
[ext_resource type="Script" path="res://scenes/game.gd" id="1_cdtng"]
|
||||||
[ext_resource type="PackedScene" uid="uid://7ux0cl08c2ho" path="res://scenes/peernode_directory.tscn" id="1_p0gju"]
|
[ext_resource type="PackedScene" uid="uid://7ux0cl08c2ho" path="res://scenes/peernode_directory.tscn" id="1_p0gju"]
|
||||||
|
@ -6,9 +6,11 @@
|
||||||
[ext_resource type="PackedScene" uid="uid://dc8pe5dnk8kbv" path="res://scenes/phase_tracker.tscn" id="4_kab4c"]
|
[ext_resource type="PackedScene" uid="uid://dc8pe5dnk8kbv" path="res://scenes/phase_tracker.tscn" id="4_kab4c"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dnryhtnk21ep1" path="res://scenes/level_manager.tscn" id="5_tdqk1"]
|
[ext_resource type="PackedScene" uid="uid://dnryhtnk21ep1" path="res://scenes/level_manager.tscn" id="5_tdqk1"]
|
||||||
[ext_resource type="PackedScene" uid="uid://g03qgetpy6b5" path="res://scenes/level_playlist.tscn" id="6_bk2n3"]
|
[ext_resource type="PackedScene" uid="uid://g03qgetpy6b5" path="res://scenes/level_playlist.tscn" id="6_bk2n3"]
|
||||||
[ext_resource type="Script" path="res://scenes/level_playlist.gd" id="7_akb5s"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://coh35s53wjxoa" path="res://scenes/golf_level_1.tscn" id="8_h8dsk"]
|
[ext_resource type="PackedScene" uid="uid://coh35s53wjxoa" path="res://scenes/golf_level_1.tscn" id="8_h8dsk"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dts4o84p3vj5c" path="res://scenes/golf_level_2.tscn" id="9_2kliu"]
|
[ext_resource type="PackedScene" uid="uid://t4qconrxwxli" path="res://scenes/golf_level_2.tscn" id="9_2kliu"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://ctv88j1pmkbqx" path="res://scenes/golf_level_3.tscn" id="9_5rfku"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bjocf7uw1bxpj" path="res://scenes/golf_level_4.tscn" id="10_hx3bj"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dff80nym71c6l" path="res://scenes/golf_level_5.tscn" id="11_2xagr"]
|
||||||
|
|
||||||
[node name="Game" type="Node" node_paths=PackedStringArray("peer_dir", "player_dir", "phase_tracker", "level_manager")]
|
[node name="Game" type="Node" node_paths=PackedStringArray("peer_dir", "player_dir", "phase_tracker", "level_manager")]
|
||||||
script = ExtResource("1_cdtng")
|
script = ExtResource("1_cdtng")
|
||||||
|
@ -28,8 +30,7 @@ playlist = NodePath("../LevelPlaylist")
|
||||||
player_dir = NodePath("../PlayerNodeDirectory")
|
player_dir = NodePath("../PlayerNodeDirectory")
|
||||||
|
|
||||||
[node name="LevelPlaylist" parent="." instance=ExtResource("6_bk2n3")]
|
[node name="LevelPlaylist" parent="." instance=ExtResource("6_bk2n3")]
|
||||||
script = ExtResource("7_akb5s")
|
levels = Array[PackedScene]([ExtResource("8_h8dsk"), ExtResource("9_2kliu"), ExtResource("9_5rfku"), ExtResource("10_hx3bj"), ExtResource("11_2xagr")])
|
||||||
levels = Array[PackedScene]([ExtResource("8_h8dsk"), ExtResource("9_2kliu")])
|
|
||||||
|
|
||||||
[connection signal="local_peernode_created" from="PeerNodeDirectory" to="." method="_on_peerdir_local_peernode_created"]
|
[connection signal="local_peernode_created" from="PeerNodeDirectory" to="." method="_on_peerdir_local_peernode_created"]
|
||||||
[connection signal="peernode_identified" from="PeerNodeDirectory" to="." method="_on_peerdir_peernode_identified"]
|
[connection signal="peernode_identified" from="PeerNodeDirectory" to="." method="_on_peerdir_peernode_identified"]
|
||||||
|
|
|
@ -12,6 +12,7 @@ script = ExtResource("1_7ng0k")
|
||||||
|
|
||||||
[node name="Circle" type="Sprite2D" parent="."]
|
[node name="Circle" type="Sprite2D" parent="."]
|
||||||
modulate = Color(1, 1, 1, 0.25098)
|
modulate = Color(1, 1, 1, 0.25098)
|
||||||
|
z_index = -1
|
||||||
scale = Vector2(0.125, 0.125)
|
scale = Vector2(0.125, 0.125)
|
||||||
texture = ExtResource("1_dw1g4")
|
texture = ExtResource("1_dw1g4")
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ func rpc_build_tilemap_cell(
|
||||||
atlas_coords: Vector2i = Vector2i(-1, -1),
|
atlas_coords: Vector2i = Vector2i(-1, -1),
|
||||||
alternative_tile: int = 0
|
alternative_tile: int = 0
|
||||||
):
|
):
|
||||||
Log.peer(self, "Building map cell: %s" % coords)
|
# Log.peer(self, "Building map cell: %s" % coords)
|
||||||
map.set_cell(layer, coords, source_id, atlas_coords, alternative_tile)
|
map.set_cell(layer, coords, source_id, atlas_coords, alternative_tile)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,33 +1,26 @@
|
||||||
[gd_scene load_steps=6 format=3 uid="uid://dts4o84p3vj5c"]
|
[gd_scene load_steps=6 format=3 uid="uid://t4qconrxwxli"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://c5ck3dhekpwb8" path="res://scenes/follow_camera.tscn" id="1_3a7ly"]
|
[ext_resource type="PackedScene" uid="uid://c5ck3dhekpwb8" path="res://scenes/follow_camera.tscn" id="1_3a7ly"]
|
||||||
[ext_resource type="Script" path="res://scenes/golf_level.gd" id="1_ac6s6"]
|
[ext_resource type="Script" path="res://scenes/golf_level.gd" id="1_ac6s6"]
|
||||||
[ext_resource type="TileSet" uid="uid://17esn8g8xqik" path="res://tiles/hole_tile_set.tres" id="1_h4d2b"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://c5vbxqhevocy7" path="res://scenes/golf_tee.tscn" id="3_6q2yk"]
|
[ext_resource type="PackedScene" uid="uid://c5vbxqhevocy7" path="res://scenes/golf_tee.tscn" id="3_6q2yk"]
|
||||||
[ext_resource type="PackedScene" uid="uid://df7t70153a3bb" path="res://scenes/golf_hole.tscn" id="3_kt60g"]
|
[ext_resource type="PackedScene" uid="uid://df7t70153a3bb" path="res://scenes/golf_hole.tscn" id="3_kt60g"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dck5lkoxskrel" path="res://scenes/golf_tilemap.tscn" id="5_pwgko"]
|
||||||
|
|
||||||
[node name="GolfLevel" type="Node2D" node_paths=PackedStringArray("camera", "tee", "hole", "map")]
|
[node name="GolfLevel" type="Node2D" node_paths=PackedStringArray("camera", "tee", "hole", "map")]
|
||||||
script = ExtResource("1_ac6s6")
|
script = ExtResource("1_ac6s6")
|
||||||
camera_follows_player = true
|
|
||||||
camera = NodePath("FollowCamera")
|
camera = NodePath("FollowCamera")
|
||||||
tee = NodePath("GolfTee")
|
tee = NodePath("GolfTee")
|
||||||
hole = NodePath("GolfHole")
|
hole = NodePath("GolfHole")
|
||||||
map = NodePath("TileMap")
|
map = NodePath("TileMap")
|
||||||
|
|
||||||
[node name="FollowCamera" parent="." instance=ExtResource("1_3a7ly")]
|
[node name="FollowCamera" parent="." instance=ExtResource("1_3a7ly")]
|
||||||
process_callback = 0
|
|
||||||
position_smoothing_enabled = true
|
|
||||||
drag_vertical_enabled = true
|
|
||||||
|
|
||||||
[node name="GolfTee" parent="." instance=ExtResource("3_6q2yk")]
|
[node name="GolfTee" parent="." instance=ExtResource("3_6q2yk")]
|
||||||
position = Vector2(0, -112)
|
position = Vector2(0, -112)
|
||||||
|
|
||||||
[node name="GolfHole" parent="." instance=ExtResource("3_kt60g")]
|
[node name="GolfHole" parent="." instance=ExtResource("3_kt60g")]
|
||||||
position = Vector2(0, 488)
|
position = Vector2(0, 100)
|
||||||
|
scale = Vector2(1.3, 1.3)
|
||||||
|
|
||||||
[node name="TileMap" type="TileMap" parent="."]
|
[node name="TileMap" parent="." instance=ExtResource("5_pwgko")]
|
||||||
scale = Vector2(0.125, 0.125)
|
layer_0/tile_data = PackedInt32Array(-393219, 2, 0, -458755, 2, 0, -524291, 2, 0, -589827, 2, 0, -589826, 2, 0, -589825, 2, 0, -655360, 2, 0, -655358, 2, 0, -655359, 2, 0, -589822, 2, 0, -524286, 2, 0, -458750, 2, 0, -65536, 2, 0, 0, 2, 0, 65535, 2, 0, -1, 2, 0, 65536, 1, 0, 1, 1, 0, 131071, 1, 268435456, 65534, 1, 268435456, -2, 1, 805306368, -65537, 1, 805306368, -131072, 1, 536870912, -65535, 1, 536870912, -393213, 1, 536870912, -327676, 1, 536870912, -262139, 1, 536870912, -196602, 1, 536870912, -327684, 1, 805306368, -262149, 1, 805306368, -196614, 1, 805306368, -131079, 1, 805306368, 196601, 1, 268435456, 262138, 1, 268435456, 327675, 1, 268435456, 458749, 1, 268435456, 393218, 1, 0, 327683, 1, 0, 262148, 1, 0, 196613, 1, 0, 131078, 1, 0, -131066, 2, 0, -65530, 2, 0, 6, 2, 0, 65542, 2, 0, -65543, 2, 0, -7, 2, 0, 65529, 2, 0, 131065, 2, 0, -327677, 1, 268435456, -262140, 1, 268435456, -196603, 1, 268435456, -393214, 1, 268435456, -327683, 1, 0, -262148, 1, 0, -196613, 1, 0, -131078, 1, 0, 196602, 1, 536870912, 262139, 1, 536870912, 327676, 1, 536870912, 393213, 1, 536870912, 458750, 1, 536870912, 393212, 1, 268435456, 393217, 1, 805306368, 327682, 1, 805306368, 262147, 1, 805306368, 196612, 1, 805306368, 131077, 1, 805306368, 524286, 1, 268435456, 458753, 1, 0, 458752, 2, 0, 524287, 2, 0)
|
||||||
tile_set = ExtResource("1_h4d2b")
|
|
||||||
format = 2
|
|
||||||
layer_0/tile_data = PackedInt32Array(131067, 2, 0, 196603, 2, 0, 262139, 2, 0, 327675, 2, 0, 393211, 2, 0, 458747, 2, 0, -196612, 1, 0, -524291, 2, 0, -458755, 2, 0, -393219, 2, 0, -327683, 2, 0, -262147, 1, 0, -589822, 2, 0, -524286, 2, 0, 65540, 2, 0, 131076, 2, 0, 196612, 2, 0, 262148, 2, 0, 327684, 2, 0, 393220, 2, 0, -196613, 1, 805306368, -262148, 1, 805306368, -589827, 2, 0, -589826, 2, 0, -589825, 2, 0, -655360, 2, 0, -655359, 2, 0, -655358, 2, 0, 524284, 1, 536870912, 458755, 1, 805306368, 589821, 1, 536870912, 524283, 1, 268435456, 589820, 1, 268435456, 524291, 1, 0, 458756, 1, 0, 524290, 1, 805306368, -196604, 2, 0, -131068, 2, 0, -65532, 2, 0, 4, 2, 0, -262140, 1, 536870912, -327677, 1, 536870912, -327678, 1, 268435456, -393214, 2, 0, -262141, 1, 268435456, -458750, 2, 0, -5, 2, 0, 65531, 2, 0, -131077, 2, 0, -65541, 2, 0, 655357, 2, 0, 720893, 2, 0, 786429, 2, 0, 851965, 2, 0, 589826, 2, 0, 655362, 2, 0, 720898, 2, 0, 786434, 2, 0, 851970, 2, 0, 917506, 2, 0, 983042, 2, 0, 917501, 2, 0, 983037, 2, 0, 1048573, 2, 0, 1114109, 1, 0, 1179644, 1, 0, 1245179, 1, 0, 1048578, 1, 268435456, 1114115, 1, 268435456, 1179652, 1, 268435456, 1114116, 1, 536870912, 1179653, 1, 536870912, 1048579, 1, 536870912, 1114108, 1, 805306368, 1179643, 1, 805306368, 1245178, 1, 805306368, 1441783, 1, 805306368, 1376248, 1, 805306368, 1441784, 1, 0, 1310713, 1, 805306368, 1376249, 1, 0, 1310714, 1, 0, 1245189, 1, 268435456, 1245190, 1, 536870912, 1310726, 1, 268435456, 1310727, 1, 536870912, 1376263, 1, 268435456, 1376264, 1, 536870912, 1441800, 1, 268435456, 1441801, 1, 536870912, 1507337, 1, 268435456, 1507338, 1, 536870912, 1572874, 1, 268435456, 1572875, 1, 536870912, 1638411, 1, 268435456, 1638412, 1, 536870912, 1703948, 1, 268435456, 1703949, 1, 536870912, 1769485, 1, 268435456, 1769486, 1, 536870912, 1834993, 1, 805306368, 1769458, 1, 805306368, 1834994, 1, 0, 1703923, 1, 805306368, 1769459, 1, 0, 1638388, 1, 805306368, 1703924, 1, 0, 1572853, 1, 805306368, 1638389, 1, 0, 1507318, 1, 805306368, 1572854, 1, 0, 1507319, 1, 0, 1900529, 2, 0, 1966065, 2, 0, 2031601, 2, 0, 2097137, 2, 0, 2162673, 2, 0, 1835022, 2, 0, 1900558, 2, 0, 1966094, 2, 0, 2031630, 2, 0, 2097166, 2, 0, 2162702, 2, 0, 2162701, 2, 0, 2162700, 2, 0, 2162699, 2, 0, 2162698, 2, 0, 2162697, 2, 0, 2162696, 2, 0, 2162695, 2, 0, 2162694, 2, 0, 2162693, 2, 0, 2162692, 2, 0, 2162691, 2, 0, 2162690, 2, 0, 2162689, 2, 0, 2162688, 2, 0, 2228223, 2, 0, 2228222, 2, 0, 2228221, 2, 0, 2228220, 2, 0, 2228219, 2, 0, 2228218, 2, 0, 2228217, 2, 0, 2228216, 2, 0, 2228215, 2, 0, 2228214, 2, 0, 2228213, 2, 0, 2228212, 2, 0, 2228211, 2, 0, 2228210, 2, 0, 2228209, 2, 0, 1245184, 3, 805306368, 1441791, 3, 805306368, 1507328, 3, 805306368, 1703935, 3, 805306368, 1769472, 3, 805306368, 1835005, 3, 805306368, 1572861, 3, 805306368, 1376258, 3, 805306368, 1638402, 3, 805306368, 1703931, 3, 805306368, 1507332, 3, 805306368)
|
|
||||||
metadata/_edit_lock_ = true
|
|
||||||
|
|
26
scenes/golf_level_3.tscn
Normal file
26
scenes/golf_level_3.tscn
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
[gd_scene load_steps=6 format=3 uid="uid://ctv88j1pmkbqx"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scenes/golf_level.gd" id="1_fikj7"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c5ck3dhekpwb8" path="res://scenes/follow_camera.tscn" id="2_0j3jn"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c5vbxqhevocy7" path="res://scenes/golf_tee.tscn" id="3_5dr6t"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://df7t70153a3bb" path="res://scenes/golf_hole.tscn" id="4_6bn3v"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dck5lkoxskrel" path="res://scenes/golf_tilemap.tscn" id="5_gmrb0"]
|
||||||
|
|
||||||
|
[node name="GolfLevel" type="Node2D" node_paths=PackedStringArray("camera", "tee", "hole", "map")]
|
||||||
|
script = ExtResource("1_fikj7")
|
||||||
|
camera = NodePath("FollowCamera")
|
||||||
|
tee = NodePath("GolfTee")
|
||||||
|
hole = NodePath("GolfHole")
|
||||||
|
map = NodePath("TileMap")
|
||||||
|
|
||||||
|
[node name="FollowCamera" parent="." instance=ExtResource("2_0j3jn")]
|
||||||
|
|
||||||
|
[node name="GolfTee" parent="." instance=ExtResource("3_5dr6t")]
|
||||||
|
position = Vector2(-10, -48)
|
||||||
|
|
||||||
|
[node name="GolfHole" parent="." instance=ExtResource("4_6bn3v")]
|
||||||
|
position = Vector2(10, -93)
|
||||||
|
scale = Vector2(1.2, 4)
|
||||||
|
|
||||||
|
[node name="TileMap" parent="." instance=ExtResource("5_gmrb0")]
|
||||||
|
layer_0/tile_data = PackedInt32Array(196615, 2, 0, 131079, 2, 0, 65543, 2, 0, 7, 2, 0, -65529, 2, 0, -327673, 2, 0, -262137, 2, 0, -196601, 2, 0, -131065, 2, 0, -524284, 2, 0, -524285, 2, 0, -524286, 2, 0, -524287, 2, 0, -524288, 2, 0, -458753, 2, 0, -458754, 2, 0, -458755, 2, 0, -458756, 2, 0, -458757, 2, 0, -262152, 2, 0, -196616, 2, 0, -131080, 2, 0, -65544, 2, 0, -8, 2, 0, 65528, 2, 0, 131064, 2, 0, 196600, 2, 0, 262136, 2, 0, -393222, 1, 0, -327687, 1, 0, -458747, 1, 268435456, -393210, 1, 268435456, -327688, 1, 805306368, -393223, 1, 805306368, -458758, 1, 805306368, -524283, 1, 536870912, -458746, 1, 536870912, -393209, 1, 536870912, 393209, 1, 536870912, 458746, 1, 536870912, 393221, 1, 805306368, 327686, 1, 805306368, 393208, 1, 268435456, 458745, 1, 268435456, 524282, 1, 268435456, 524283, 2, 0, 524284, 2, 0, 524285, 2, 0, 524286, 2, 0, 524287, 2, 0, 458752, 2, 0, 458753, 2, 0, 458754, 2, 0, 458755, 2, 0, 458756, 2, 0, 458757, 1, 0, 393222, 1, 0, 327687, 1, 0, 327672, 2, 0, 262151, 2, 0, -65537, 2, 0, -1, 2, 0, -2, 2, 0, 65534, 2, 0, 65535, 2, 0, 131071, 2, 0, 65536, 2, 0, 0, 2, 0, -65536, 2, 0, -131072, 2, 0, -65535, 2, 0, 1, 2, 0, -65538, 1, 805306368, -3, 1, 805306368, -131071, 1, 536870912, -65534, 1, 536870912, 2, 1, 0, 65537, 1, 0, 131072, 1, 0, 196607, 1, 268435456, 131070, 1, 268435456, 65533, 1, 268435456, -196608, 2, 0, -262144, 2, 0, -327681, 2, 0, -393217, 2, 0, -327680, 1, 536870912, -262145, 1, 268435456)
|
25
scenes/golf_level_4.tscn
Normal file
25
scenes/golf_level_4.tscn
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
[gd_scene load_steps=6 format=3 uid="uid://bjocf7uw1bxpj"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scenes/golf_level.gd" id="1_mlgxe"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c5ck3dhekpwb8" path="res://scenes/follow_camera.tscn" id="2_gok1m"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c5vbxqhevocy7" path="res://scenes/golf_tee.tscn" id="3_87md7"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://df7t70153a3bb" path="res://scenes/golf_hole.tscn" id="4_dydjv"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dck5lkoxskrel" path="res://scenes/golf_tilemap.tscn" id="5_iqqbt"]
|
||||||
|
|
||||||
|
[node name="GolfLevel" type="Node2D" node_paths=PackedStringArray("camera", "tee", "hole", "map")]
|
||||||
|
script = ExtResource("1_mlgxe")
|
||||||
|
camera_follows_player = true
|
||||||
|
camera = NodePath("FollowCamera")
|
||||||
|
tee = NodePath("GolfTee")
|
||||||
|
hole = NodePath("GolfHole")
|
||||||
|
map = NodePath("TileMap")
|
||||||
|
|
||||||
|
[node name="FollowCamera" parent="." instance=ExtResource("2_gok1m")]
|
||||||
|
|
||||||
|
[node name="GolfTee" parent="." instance=ExtResource("3_87md7")]
|
||||||
|
|
||||||
|
[node name="GolfHole" parent="." instance=ExtResource("4_dydjv")]
|
||||||
|
position = Vector2(0, -208)
|
||||||
|
|
||||||
|
[node name="TileMap" parent="." instance=ExtResource("5_iqqbt")]
|
||||||
|
layer_0/tile_data = PackedInt32Array(-458748, 2, 0, -393221, 2, 0, 131070, 2, 0, 65534, 2, 0, -2, 2, 0, -65538, 2, 0, 131071, 2, 0, 65536, 2, 0, 65537, 2, 0, 1, 2, 0, -65535, 2, 0, -131071, 2, 0, -458749, 2, 0, -458750, 2, 0, -458751, 2, 0, -458752, 2, 0, -393217, 2, 0, -393218, 2, 0, -393219, 2, 0, -393220, 2, 0, -393222, 2, 0, -393223, 2, 0, -327687, 2, 0, -262151, 2, 0, -196615, 2, 0, 65529, 2, 0, 131065, 2, 0, 196601, 2, 0, -7, 2, 0, -65543, 2, 0, -131079, 2, 0, 262137, 2, 0, 327673, 2, 0, 393209, 2, 0, 458745, 2, 0, -458746, 2, 0, -458747, 2, 0, 393222, 2, 0, -393210, 2, 0, -327674, 2, 0, -262138, 2, 0, 327686, 2, 0, -131066, 2, 0, -65530, 2, 0, 6, 2, 0, 65542, 2, 0, 262150, 2, 0, 196614, 2, 0, 131078, 2, 0, -196602, 2, 0, 1114105, 2, 0, 1114106, 2, 0, 1114107, 2, 0, 1114108, 2, 0, 1114109, 2, 0, 1114110, 2, 0, 1114111, 2, 0, 1048576, 2, 0, 1048577, 2, 0, 1048578, 2, 0, 1048579, 2, 0, 1048580, 2, 0, 1048581, 2, 0, 1048582, 2, 0, 1048583, 2, 0, 1114104, 2, 0, 1114103, 2, 0, 1114102, 2, 0, 1114101, 2, 0, 458736, 2, 0, 524272, 2, 0, 851952, 2, 0, 917488, 2, 0, 786416, 2, 0, 720880, 2, 0, 589808, 2, 0, 655344, 2, 0, 983024, 2, 0, 1048560, 2, 0, 1114097, 2, 0, 1114098, 2, 0, 1114099, 2, 0, 1114100, 2, 0, 1114096, 2, 0, 393200, 2, 0, 327664, 2, 0, 262128, 2, 0, 196592, 2, 0, 131056, 2, 0, 65520, 2, 0, -16, 2, 0, -65552, 2, 0, -131088, 2, 0, -196624, 2, 0, -262160, 2, 0, -327696, 2, 0, -393232, 2, 0, -458768, 2, 0, -524304, 2, 0, -589840, 2, 0, -655376, 2, 0, -720912, 2, 0, -786448, 2, 0, -851984, 2, 0, -917520, 2, 0, -983056, 2, 0, -1048561, 2, 0, -983025, 2, 0, -917489, 2, 0, -851953, 2, 0, -786417, 2, 0, -655345, 2, 0, -589809, 2, 0, -524273, 2, 0, -458737, 2, 0, -720881, 2, 0, -393201, 2, 0, -327665, 2, 0, -262129, 2, 0, -196593, 2, 0, -131057, 2, 0, -65521, 2, 0, 15, 2, 0, 65551, 2, 0, 131087, 2, 0, 196623, 2, 0, 262159, 2, 0, 327695, 2, 0, 393231, 2, 0, 458767, 2, 0, 524303, 2, 0, 589839, 2, 0, 655375, 2, 0, 720911, 2, 0, 786447, 2, 0, 851983, 2, 0, 917519, 2, 0, 983055, 2, 0, 1048591, 2, 0, 1048590, 2, 0, 1048589, 2, 0, 1048588, 2, 0, 1048584, 2, 0, 1048585, 2, 0, 1048586, 2, 0, 1048587, 2, 0, -458759, 1, 805306368, -524294, 1, 805306368, -524285, 1, 805306368, -589820, 1, 805306368, -589819, 1, 536870912, -524282, 1, 536870912, -458756, 1, 536870912, -524293, 1, 536870912, -458757, 2, 0, -458758, 2, 0, -524283, 2, 0, -524284, 2, 0, -1114097, 2, 0, -1179633, 2, 0, -1114128, 2, 0, -1048592, 2, 0, -1179664, 2, 0, -1179663, 2, 0, -1179662, 2, 0, -1179661, 2, 0, -1179660, 2, 0, -1179659, 2, 0, -1179658, 2, 0, -1179657, 2, 0, -1179656, 2, 0, -1179655, 2, 0, -1179654, 2, 0, -1179653, 2, 0, -1179652, 2, 0, -1179651, 2, 0, -1179650, 2, 0, -1179649, 2, 0, -1245184, 2, 0, -1245183, 2, 0, -1245182, 2, 0, -1245181, 2, 0, -1245180, 2, 0, -1245179, 2, 0, -1245178, 2, 0, -1245177, 2, 0, -1245176, 2, 0, -1245175, 2, 0, -1245174, 2, 0, -1245173, 2, 0, -1245172, 2, 0, -1245171, 2, 0, -1245170, 2, 0, -1245169, 2, 0, -1179642, 1, 0, -1114107, 1, 0, -1114108, 1, 268435456, -1179645, 1, 268435456, -1179643, 2, 0, -1179644, 2, 0, -1114119, 1, 268435456, -1114118, 2, 0, -1048582, 1, 268435456, -1114117, 2, 0, -1048581, 1, 0, -1114116, 1, 0, -1310732, 2, 0, -1376268, 2, 0, -1441804, 2, 0, -1507340, 2, 0, -1572876, 2, 0, -1638412, 2, 0, -1638411, 2, 0, -1638410, 2, 0, -1638409, 2, 0, -1638408, 2, 0, -1638407, 2, 0, -1572871, 2, 0, -1507335, 2, 0, -1441799, 2, 0, -1376263, 2, 0, -1310727, 2, 0, -1310728, 2, 0, -1310729, 2, 0, -1310730, 2, 0, -1310731, 2, 0, -1441802, 2, 0, -1507338, 2, 0, -1507337, 2, 0, -1441801, 2, 0, -1703930, 2, 0, -1638394, 2, 0, -1572858, 2, 0, -1507322, 2, 0, -1441786, 2, 0, -1376250, 2, 0, -1703929, 2, 0, -1376249, 2, 0, -1703928, 2, 0, -1572856, 2, 0, -1507320, 2, 0, -1376248, 2, 0, -1703927, 2, 0, -1572855, 2, 0, -1507319, 2, 0, -1376247, 2, 0, -1703926, 2, 0, -1376246, 2, 0, -1703925, 2, 0, -1638389, 2, 0, -1572853, 2, 0, -1507317, 2, 0, -1441781, 2, 0, -1376245, 2, 0)
|
27
scenes/golf_level_5.tscn
Normal file
27
scenes/golf_level_5.tscn
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
[gd_scene load_steps=6 format=3 uid="uid://dff80nym71c6l"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scenes/golf_level.gd" id="1_fogx3"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c5ck3dhekpwb8" path="res://scenes/follow_camera.tscn" id="2_hx4t3"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c5vbxqhevocy7" path="res://scenes/golf_tee.tscn" id="3_vx1bc"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://df7t70153a3bb" path="res://scenes/golf_hole.tscn" id="4_pg8r1"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dck5lkoxskrel" path="res://scenes/golf_tilemap.tscn" id="5_0jd1e"]
|
||||||
|
|
||||||
|
[node name="GolfLevel" type="Node2D" node_paths=PackedStringArray("camera", "tee", "hole", "map")]
|
||||||
|
script = ExtResource("1_fogx3")
|
||||||
|
camera_follows_player = true
|
||||||
|
camera = NodePath("FollowCamera")
|
||||||
|
tee = NodePath("GolfTee")
|
||||||
|
hole = NodePath("GolfHole")
|
||||||
|
map = NodePath("TileMap")
|
||||||
|
|
||||||
|
[node name="FollowCamera" parent="." instance=ExtResource("2_hx4t3")]
|
||||||
|
|
||||||
|
[node name="GolfTee" parent="." instance=ExtResource("3_vx1bc")]
|
||||||
|
position = Vector2(0, -112)
|
||||||
|
|
||||||
|
[node name="GolfHole" parent="." instance=ExtResource("4_pg8r1")]
|
||||||
|
position = Vector2(0, 1304)
|
||||||
|
scale = Vector2(1, 1.05)
|
||||||
|
|
||||||
|
[node name="TileMap" parent="." instance=ExtResource("5_0jd1e")]
|
||||||
|
layer_0/tile_data = PackedInt32Array(-458748, 2, 0, -524284, 2, 0, -589820, 2, 0, -655356, 2, 0, -655357, 2, 0, -655358, 2, 0, -655359, 2, 0, -655360, 2, 0, -589825, 2, 0, -589826, 2, 0, -589827, 2, 0, -589828, 2, 0, -589829, 2, 0, -524293, 2, 0, -458757, 2, 0, -393221, 2, 0, -327685, 2, 0, -262149, 2, 0, -393212, 2, 0, -327676, 2, 0, -262140, 2, 0, -196604, 2, 0, -131068, 2, 0, -65532, 2, 0, -196613, 2, 0, -131077, 2, 0, -65541, 2, 0, -5, 2, 0, 65531, 2, 0, 131067, 2, 0, 196603, 2, 0, 262139, 2, 0, 327675, 2, 0, 393211, 2, 0, 458747, 2, 0, 524283, 2, 0, 589819, 2, 0, 524292, 2, 0, 4, 2, 0, 65540, 2, 0, 131076, 2, 0, 196612, 2, 0, 262148, 2, 0, 327684, 2, 0, 393220, 2, 0, 458756, 2, 0, -393210, 3, 0, -196602, 3, 0, -589818, 3, 0, 655355, 2, 0, 720891, 2, 0, 786427, 2, 0, 851963, 2, 0, 917499, 2, 0, 983035, 2, 0, 1048571, 2, 0, 1114107, 2, 0, 1179643, 2, 0, 1245179, 2, 0, 1310715, 2, 0, 1376251, 2, 0, 1441787, 2, 0, 1507323, 2, 0, 1572859, 2, 0, 1638395, 2, 0, 1703931, 2, 0, 1769467, 2, 0, 1835003, 2, 0, 1900539, 2, 0, 1966075, 2, 0, 2031611, 2, 0, 589828, 2, 0, 655364, 2, 0, 720900, 2, 0, 786436, 2, 0, 851972, 2, 0, 917508, 2, 0, 983044, 2, 0, 1048580, 2, 0, 1114116, 2, 0, 1179652, 2, 0, 1245188, 2, 0, 1310724, 2, 0, 1376260, 2, 0, 1441796, 2, 0, 1507332, 2, 0, 1572868, 2, 0, 1638404, 2, 0, 1703940, 2, 0, 1769476, 2, 0, 1835012, 2, 0, 1900548, 2, 0, 1966084, 2, 0, 2031620, 2, 0, 2097156, 2, 0, 2162683, 2, 0, 2228219, 2, 0, 2293755, 2, 0, 2359291, 2, 0, 2424827, 2, 0, 2097147, 2, 0, 2162692, 2, 0, 2228228, 2, 0, 2293764, 2, 0, 2359300, 2, 0, 2424836, 2, 0, 2490372, 2, 0, 2555908, 2, 0, 2621444, 2, 0, 2686980, 2, 0, 2752516, 2, 0, 2818052, 2, 0, 2883588, 2, 0, 2949124, 2, 0, 3014660, 2, 0, 3080196, 2, 0, 3145732, 2, 0, 3211268, 2, 0, 3276804, 2, 0, 3342340, 2, 0, 3407876, 2, 0, 2490363, 2, 0, 2555899, 2, 0, 2621435, 2, 0, 2686971, 2, 0, 2752507, 2, 0, 2818043, 2, 0, 2883579, 2, 0, 2949115, 2, 0, 3080187, 2, 0, 3145723, 2, 0, 3211259, 2, 0, 3276795, 2, 0, 3342331, 2, 0, 3407867, 2, 0, 3473403, 2, 0, 3538939, 2, 0, 3604475, 2, 0, 3670011, 2, 0, 3735547, 2, 0, 3538948, 2, 0, 3604484, 2, 0, 3473412, 2, 0, 3670020, 2, 0, 3735556, 2, 0, 3801092, 2, 0, 3866628, 2, 0, 3932164, 2, 0, 3997700, 2, 0, 4063236, 2, 0, 4128772, 2, 0, 4194308, 2, 0, 4259844, 2, 0, 4325380, 2, 0, 4390916, 2, 0, 4456452, 2, 0, 4521988, 2, 0, 4587524, 2, 0, 4653060, 2, 0, 4718596, 2, 0, 4784132, 2, 0, 4849668, 2, 0, 4915204, 2, 0, 4980740, 2, 0, 5046276, 2, 0, 5111812, 2, 0, 5177348, 2, 0, 5242884, 2, 0, 5308420, 2, 0, 5373956, 2, 0, 5439492, 2, 0, 5505028, 2, 0, 5570564, 2, 0, 3801083, 2, 0, 3866619, 2, 0, 3932155, 2, 0, 3997691, 2, 0, 4063227, 2, 0, 4128763, 2, 0, 4194299, 2, 0, 4259835, 2, 0, 4325371, 2, 0, 4390907, 2, 0, 4456443, 2, 0, 4521979, 2, 0, 4587515, 2, 0, 4653051, 2, 0, 4718587, 2, 0, 4784123, 2, 0, 4849659, 2, 0, 4915195, 2, 0, 4980731, 2, 0, 5046267, 2, 0, 5111803, 2, 0, 5177339, 2, 0, 5242875, 2, 0, 5308411, 2, 0, 5373947, 2, 0, 5439483, 2, 0, 5505019, 2, 0, 5570555, 2, 0, 5636091, 2, 0, 5701627, 2, 0, 5701628, 2, 0, 5701629, 2, 0, 5701630, 2, 0, 5701631, 2, 0, 5636096, 2, 0, 5636097, 2, 0, 5636098, 2, 0, 5636099, 2, 0, 5636100, 2, 0, 6, 3, 0, 196614, 3, 0, 393222, 3, 0, 589830, 3, 0, 786438, 3, 0, 983046, 3, 0, 1179654, 3, 0, 1376262, 3, 0, 1572870, 3, 0, 1769478, 3, 0, 1966086, 3, 0, 2162694, 3, 0, 2359302, 3, 0, 2555910, 3, 0, 2752518, 3, 0, 2949126, 3, 0, 3145734, 3, 0, 3342342, 3, 0, 3538950, 3, 0, 3735558, 3, 0, 3932166, 3, 0, 4128774, 3, 0, 4325382, 3, 0, 4521990, 3, 0, 4718598, 3, 0, 4915206, 3, 0, 5111814, 3, 0, -524295, 3, 0, -327687, 3, 0, -131079, 3, 0, 65529, 3, 0, 262137, 3, 0, 458745, 3, 0, 655353, 3, 0, 851961, 3, 0, 1048569, 3, 0, 1245177, 3, 0, 1441785, 3, 0, 1638393, 3, 0, 1835001, 3, 0, 2031609, 3, 0, 2228217, 3, 0, 2424825, 3, 0, 2621433, 3, 0, 2818041, 3, 0, 3014649, 3, 0, 3211257, 3, 0, 3407865, 3, 0, 3604473, 3, 0, 3801081, 3, 0, 3997689, 3, 0, 4194297, 3, 0, 4390905, 3, 0, 4587513, 3, 0, 4784121, 3, 0, 4980729, 3, 0, 5177337, 3, 0, 5505030, 3, 536870912, 5570553, 3, 536870912, 5373945, 3, 1073741824, 5308422, 3, 1879048192, 5308418, 3, 1879048192, 5373949, 3, 1073741824, 5505024, 1, 1610612736, 5570559, 1, 1879048192, 5177343, 1, 1342177280, 5111808, 1, 1073741824, 1179650, 3, 0, 1572865, 3, 0, 1638397, 3, 0, 1441790, 3, 0, 1769472, 3, 0, 2031615, 3, 0, 2228220, 3, 0, 1835004, 3, 0, 2162688, 3, 0, 2424829, 3, 0, 3014651, 2, 0, 2949123, 3, 0, 3014652, 3, 0, 2752514, 3, 268435456, 2818045, 3, 268435456, 3211263, 3, 0, 2555904, 3, 0, 3145730, 3, 0, 3407869, 3, 0, 3342337, 3, 0, 3604479, 3, 0, 3801085, 3, 0, 3735553, 3, 0, 3538946, 3, 0, 3604476, 3, 0, 4194302, 3, 0, 4128768, 3, 0, 4325379, 3, 0, 4325378, 3, 0, 4390910, 3, 0, 4390909, 3, 0, 4194303, 3, 0, 4587518, 3, 0, 4521986, 3, 0, 4784127, 3, 0, 4718593, 3, 0, 4915200, 3, 0, 4980734, 3, 0, 4980732, 3, 0, 4915202, 3, 0)
|
|
@ -28,6 +28,8 @@ func spawn(playernode: PlayerNode, tposition: Vector2 = Vector2.ZERO, tstrokes:
|
||||||
obj.set_multiplayer_authority(playernode.get_multiplayer_authority())
|
obj.set_multiplayer_authority(playernode.get_multiplayer_authority())
|
||||||
obj.putt_controller.set_multiplayer_authority(playernode.get_multiplayer_authority())
|
obj.putt_controller.set_multiplayer_authority(playernode.get_multiplayer_authority())
|
||||||
obj.putt_controller.can_putt = not multiplayer.is_server() and playernode.is_multiplayer_authority()
|
obj.putt_controller.can_putt = not multiplayer.is_server() and playernode.is_multiplayer_authority()
|
||||||
|
if obj.get_multiplayer_authority() == 1:
|
||||||
|
obj.hide()
|
||||||
if thole:
|
if thole:
|
||||||
obj.enter_hole()
|
obj.enter_hole()
|
||||||
# Create callables to be able to cleanup signals on destruction
|
# Create callables to be able to cleanup signals on destruction
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
[gd_scene format=3 uid="uid://g03qgetpy6b5"]
|
[gd_scene load_steps=2 format=3 uid="uid://g03qgetpy6b5"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scenes/level_playlist.gd" id="1_gqx2w"]
|
||||||
|
|
||||||
[node name="LevelPlaylist" type="Node"]
|
[node name="LevelPlaylist" type="Node"]
|
||||||
|
script = ExtResource("1_gqx2w")
|
||||||
|
|
|
@ -160,10 +160,13 @@ func _on_connecting_confirmed(player_name: String, player_color: Color, server_a
|
||||||
init_lobby_menu()
|
init_lobby_menu()
|
||||||
|
|
||||||
func _on_lost_connection() -> void:
|
func _on_lost_connection() -> void:
|
||||||
|
print("[Main] On lost connection...")
|
||||||
if lobby_menu_instance != null:
|
if lobby_menu_instance != null:
|
||||||
deinit_lobby_menu()
|
deinit_lobby_menu()
|
||||||
if game_hud_instance != null:
|
if game_hud_instance != null:
|
||||||
deinit_game_hud()
|
deinit_game_hud()
|
||||||
|
if results_menu_instance != null:
|
||||||
|
deinit_results_menu()
|
||||||
if client_game_instance != null:
|
if client_game_instance != null:
|
||||||
deinit_client_game()
|
deinit_client_game()
|
||||||
if server_game_instance != null:
|
if server_game_instance != null:
|
||||||
|
|
|
@ -108,6 +108,8 @@ func end_putt(end_position: Vector2):
|
||||||
|
|
||||||
@rpc("authority", "call_local", "reliable")
|
@rpc("authority", "call_local", "reliable")
|
||||||
func play_putt_sound(putt_vector: Vector2):
|
func play_putt_sound(putt_vector: Vector2):
|
||||||
|
if multiplayer.is_server():
|
||||||
|
return
|
||||||
var putt_impulse: float = putt_vector.length()
|
var putt_impulse: float = putt_vector.length()
|
||||||
sound.volume_db = putt_volume.sample(putt_impulse / putt_max_impulse)
|
sound.volume_db = putt_volume.sample(putt_impulse / putt_max_impulse)
|
||||||
sound.play()
|
sound.play()
|
||||||
|
|
|
@ -6,7 +6,8 @@ class_name ResultsMenu
|
||||||
|
|
||||||
@export var results_grid: GridContainer
|
@export var results_grid: GridContainer
|
||||||
|
|
||||||
const label_scene: PackedScene = preload("res://scenes/player_label.tscn")
|
const player_label_scene: PackedScene = preload("res://scenes/player_label.tscn")
|
||||||
|
const score_label_scene: PackedScene = preload("res://scenes/score_label.tscn")
|
||||||
|
|
||||||
|
|
||||||
var player_dir: PlayerNodeDirectory = null
|
var player_dir: PlayerNodeDirectory = null
|
||||||
|
@ -17,7 +18,7 @@ func _ready():
|
||||||
var max_hole_scores = 0
|
var max_hole_scores = 0
|
||||||
|
|
||||||
for playernode in player_dir.get_children():
|
for playernode in player_dir.get_children():
|
||||||
var player: PlayerLabel = label_scene.instantiate()
|
var player: PlayerLabel = player_label_scene.instantiate()
|
||||||
player.set_player_name(playernode.player_name)
|
player.set_player_name(playernode.player_name)
|
||||||
player.set_player_color(playernode.player_color)
|
player.set_player_color(playernode.player_color)
|
||||||
player.set_possessed(playernode.get_multiplayer_authority())
|
player.set_possessed(playernode.get_multiplayer_authority())
|
||||||
|
@ -26,30 +27,20 @@ func _ready():
|
||||||
max_hole_scores = max(max_hole_scores, len(playernode.hole_scores))
|
max_hole_scores = max(max_hole_scores, len(playernode.hole_scores))
|
||||||
var total_score = 0
|
var total_score = 0
|
||||||
for hole_score in playernode.hole_scores:
|
for hole_score in playernode.hole_scores:
|
||||||
var score: PlayerLabel = label_scene.instantiate()
|
var score: ScoreLabel = score_label_scene.instantiate()
|
||||||
if hole_score != -1:
|
score.set_partial(hole_score)
|
||||||
score.text = "%d" % hole_score
|
|
||||||
else:
|
|
||||||
score.text = "-"
|
|
||||||
score.set_player_color(playernode.player_color)
|
score.set_player_color(playernode.player_color)
|
||||||
score.set_possessed(playernode.get_multiplayer_authority())
|
score.set_possessed(playernode.get_multiplayer_authority())
|
||||||
score.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT
|
|
||||||
score.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
|
|
||||||
results_grid.add_child(score)
|
results_grid.add_child(score)
|
||||||
if hole_score == -1 or total_score == -1:
|
if hole_score == -1 or total_score == -1:
|
||||||
total_score = -1
|
total_score = -1
|
||||||
else:
|
else:
|
||||||
total_score += hole_score
|
total_score += hole_score
|
||||||
|
|
||||||
var total: PlayerLabel = label_scene.instantiate()
|
var total: ScoreLabel = score_label_scene.instantiate()
|
||||||
if total_score != -1:
|
total.set_total(total_score)
|
||||||
total.text = "[%d]" % total_score
|
|
||||||
else:
|
|
||||||
total.text = "-"
|
|
||||||
total.set_player_color(playernode.player_color)
|
total.set_player_color(playernode.player_color)
|
||||||
total.set_possessed(playernode.get_multiplayer_authority())
|
total.set_possessed(playernode.get_multiplayer_authority())
|
||||||
total.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT
|
|
||||||
total.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
|
|
||||||
results_grid.add_child(total)
|
results_grid.add_child(total)
|
||||||
|
|
||||||
results_grid.columns = max_hole_scores + 2
|
results_grid.columns = max_hole_scores + 2
|
||||||
|
|
26
scenes/score_label.gd
Normal file
26
scenes/score_label.gd
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
extends RichTextLabel
|
||||||
|
class_name ScoreLabel
|
||||||
|
|
||||||
|
|
||||||
|
func set_partial(value: int):
|
||||||
|
if value == -1:
|
||||||
|
text = "[code][right]-[/right][/code]"
|
||||||
|
else:
|
||||||
|
text = "[code][right]%s[/right][/code]" % value
|
||||||
|
|
||||||
|
func set_total(value: int):
|
||||||
|
if value == -1:
|
||||||
|
text = "[code][right]-[/right][/code]"
|
||||||
|
else:
|
||||||
|
text = "[code][right][b]%s[/b][/right][/code]" % value
|
||||||
|
|
||||||
|
func set_player_color(value: Color):
|
||||||
|
modulate.r = value.r
|
||||||
|
modulate.g = value.g
|
||||||
|
modulate.b = value.b
|
||||||
|
|
||||||
|
func set_possessed(value: int):
|
||||||
|
if value == 1:
|
||||||
|
modulate.a = 0.3
|
||||||
|
else:
|
||||||
|
modulate.a = 1.0
|
15
scenes/score_label.tscn
Normal file
15
scenes/score_label.tscn
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
[gd_scene load_steps=2 format=3 uid="uid://cet7wi57k8gd0"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scenes/score_label.gd" id="1_yia33"]
|
||||||
|
|
||||||
|
[node name="ScoreLabel" type="RichTextLabel"]
|
||||||
|
custom_minimum_size = Vector2(20, 0)
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
bbcode_enabled = true
|
||||||
|
text = "[right][b]9[/b][/right]"
|
||||||
|
fit_content = true
|
||||||
|
script = ExtResource("1_yia33")
|
Loading…
Reference in a new issue