score board
This commit is contained in:
34
export_files/banner.png.import
Normal file
34
export_files/banner.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://ci8v25oyjsta7"
|
||||
path="res://.godot/imported/banner.png-becbe5b95b7f582b376b39bf2d9a8088.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://export_files/banner.png"
|
||||
dest_files=["res://.godot/imported/banner.png-becbe5b95b7f582b376b39bf2d9a8088.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
34
export_files/hero.png.import
Normal file
34
export_files/hero.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dhte4m2jqqnk3"
|
||||
path="res://.godot/imported/hero.png-fdcb9bce42f62e97d19e35f646c3e9ae.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://export_files/hero.png"
|
||||
dest_files=["res://.godot/imported/hero.png-fdcb9bce42f62e97d19e35f646c3e9ae.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
34
export_files/icon.png.import
Normal file
34
export_files/icon.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c16lf6uuia72r"
|
||||
path="res://.godot/imported/icon.png-50ce51b05e583df21dba5e6ade4274ef.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://export_files/icon.png"
|
||||
dest_files=["res://.godot/imported/icon.png-50ce51b05e583df21dba5e6ade4274ef.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
19
export_files/theme.ogg.import
Normal file
19
export_files/theme.ogg.import
Normal file
@@ -0,0 +1,19 @@
|
||||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://bfyklo8ca5kji"
|
||||
path="res://.godot/imported/theme.ogg-2a8b680f31de6ed20a965148078a2666.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://export_files/theme.ogg"
|
||||
dest_files=["res://.godot/imported/theme.ogg-2a8b680f31de6ed20a965148078a2666.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
@@ -92,22 +92,24 @@ func start_score_saver(score: int)->void:
|
||||
get_tree().call_deferred("change_scene_to_file", "res://scene/score_saver.tscn")
|
||||
|
||||
|
||||
func get_scoreboard_singleplayer() -> String:
|
||||
return " 1 Player" + _get_scoreboard(score.score_singleplayer)
|
||||
func get_scoreboard_singleplayer(n_lignes: int = 0) -> String:
|
||||
return " 1 Player" + _get_scoreboard(score.score_singleplayer, n_lignes)
|
||||
|
||||
func get_scoreboard_multiplayer() -> String:
|
||||
return " 2 Player" + _get_scoreboard(score.score_multiplayer)
|
||||
func get_scoreboard_multiplayer(n_lignes: int = 0) -> String:
|
||||
return " 2 Player" + _get_scoreboard(score.score_multiplayer, n_lignes)
|
||||
|
||||
func _get_scoreboard(dict: Dictionary) -> String:
|
||||
func _get_scoreboard(dict: Dictionary, n_lignes: int) -> String:
|
||||
var text = ""
|
||||
var tableau_paires = []
|
||||
for key in dict:
|
||||
tableau_paires.append({"key": key, "value": dict[key]})
|
||||
tableau_paires.sort_custom(func(a, b): return a["value"] > b["value"])
|
||||
for i in range(clamp(5, 0, tableau_paires.size())):
|
||||
if n_lignes == 0:
|
||||
n_lignes = clamp( tableau_paires.size(), 5, 1000)
|
||||
for i in range(clamp(n_lignes, 0, tableau_paires.size())):
|
||||
text += "\n" + str(i+1) + ". " + tableau_paires[i]["key"] + " : " + display_score(tableau_paires[i]["value"])
|
||||
if tableau_paires.size() < 5:
|
||||
for i in range(5 - tableau_paires.size()):
|
||||
if tableau_paires.size() < n_lignes:
|
||||
for i in range(n_lignes - tableau_paires.size()):
|
||||
text += "\n" + str(tableau_paires.size()+ i+1) + ". " + "---- : ----"
|
||||
return text
|
||||
|
||||
|
||||
@@ -119,6 +119,12 @@ right={
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
back={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194308,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":1,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[physics]
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[gd_scene load_steps=9 format=3 uid="uid://jx8hrj6k1ju8"]
|
||||
[gd_scene load_steps=13 format=3 uid="uid://jx8hrj6k1ju8"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://d1ugwu6dqomtg" path="res://scene/wall.tscn" id="1_7iavl"]
|
||||
[ext_resource type="Theme" uid="uid://b46gto6k33wqr" path="res://theme.tres" id="3_7iavl"]
|
||||
[ext_resource type="Script" uid="uid://dkolsh66l73k0" path="res://script/canvas_load.gd" id="3_pyuau"]
|
||||
[ext_resource type="PackedScene" uid="uid://b6hqwxrexoa2n" path="res://scene/spawner.tscn" id="3_ruca2"]
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_pyuau"]
|
||||
@@ -38,11 +39,29 @@ script/source = "extends Label
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
text = GameController.get_scoreboard_singleplayer()
|
||||
text = GameController.get_scoreboard_singleplayer(5)
|
||||
"
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_u3kfb"]
|
||||
script/source = "extends Label
|
||||
func _ready() -> void:
|
||||
text = GameController.get_scoreboard_multiplayer(5)
|
||||
"
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_pyuau"]
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_8llpu"]
|
||||
script/source = "extends Label
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
text = GameController.get_scoreboard_singleplayer()
|
||||
"
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_dyrmm"]
|
||||
script/source = "extends Label
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
text = GameController.get_scoreboard_multiplayer()
|
||||
"
|
||||
@@ -63,8 +82,10 @@ load_screen = true
|
||||
[node name="CharacterBody2D" type="CharacterBody2D" parent="."]
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||
script = ExtResource("3_pyuau")
|
||||
|
||||
[node name="Control" type="Control" parent="CanvasLayer"]
|
||||
custom_minimum_size = Vector2(640, 640)
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
@@ -119,6 +140,15 @@ theme = ExtResource("3_7iavl")
|
||||
text = "2 Players"
|
||||
script = SubResource("GDScript_ruca2")
|
||||
|
||||
[node name="scores" type="Button" parent="CanvasLayer/Control/VBoxContainer/HBoxContainer/buttons"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 0
|
||||
focus_next = NodePath("../exit")
|
||||
focus_previous = NodePath("../1")
|
||||
theme = ExtResource("3_7iavl")
|
||||
text = "Scores"
|
||||
|
||||
[node name="exit" type="Button" parent="CanvasLayer/Control/VBoxContainer/HBoxContainer/buttons"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
@@ -146,6 +176,47 @@ theme = ExtResource("3_7iavl")
|
||||
theme_override_font_sizes/font_size = 16
|
||||
script = SubResource("GDScript_u3kfb")
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="CanvasLayer/Control"]
|
||||
visible = false
|
||||
custom_minimum_size = Vector2(0, 320)
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -7.0
|
||||
offset_right = 7.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme = ExtResource("3_7iavl")
|
||||
draw_focus_border = true
|
||||
horizontal_scroll_mode = 0
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="CanvasLayer/Control/ScrollContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 6
|
||||
size_flags_vertical = 4
|
||||
theme = ExtResource("3_7iavl")
|
||||
theme_override_constants/separation = 32
|
||||
|
||||
[node name="Label" type="Label" parent="CanvasLayer/Control/ScrollContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 0
|
||||
theme = ExtResource("3_7iavl")
|
||||
theme_override_font_sizes/font_size = 16
|
||||
theme_override_styles/normal = SubResource("StyleBoxEmpty_pyuau")
|
||||
script = SubResource("GDScript_8llpu")
|
||||
|
||||
[node name="Label2" type="Label" parent="CanvasLayer/Control/ScrollContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 0
|
||||
theme = ExtResource("3_7iavl")
|
||||
theme_override_font_sizes/font_size = 16
|
||||
theme_override_styles/normal = SubResource("StyleBoxEmpty_pyuau")
|
||||
script = SubResource("GDScript_dyrmm")
|
||||
|
||||
[connection signal="pressed" from="CanvasLayer/Control/VBoxContainer/HBoxContainer/buttons/1" to="CanvasLayer/Control/VBoxContainer/HBoxContainer/buttons/1" method="_on_pressed"]
|
||||
[connection signal="pressed" from="CanvasLayer/Control/VBoxContainer/HBoxContainer/buttons/2" to="CanvasLayer/Control/VBoxContainer/HBoxContainer/buttons/2" method="_on_pressed"]
|
||||
[connection signal="pressed" from="CanvasLayer/Control/VBoxContainer/HBoxContainer/buttons/scores" to="CanvasLayer" method="_on_scores_pressed"]
|
||||
[connection signal="pressed" from="CanvasLayer/Control/VBoxContainer/HBoxContainer/buttons/exit" to="CanvasLayer/Control/VBoxContainer/HBoxContainer/buttons/exit" method="_on_pressed"]
|
||||
|
||||
19
script/canvas_load.gd
Normal file
19
script/canvas_load.gd
Normal file
@@ -0,0 +1,19 @@
|
||||
extends CanvasLayer
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
if Input.is_action_just_pressed("back") and $Control/ScrollContainer.visible:
|
||||
$Control/VBoxContainer.visible = true
|
||||
$Control/ScrollContainer.visible = false
|
||||
$"Control/VBoxContainer/HBoxContainer/buttons/1".grab_focus()
|
||||
|
||||
func _on_scores_pressed() -> void:
|
||||
$Control/VBoxContainer.grab_focus()
|
||||
$Control/VBoxContainer.visible = false
|
||||
$Control/ScrollContainer.visible = true
|
||||
1
script/canvas_load.gd.uid
Normal file
1
script/canvas_load.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dkolsh66l73k0
|
||||
@@ -68,7 +68,7 @@ func spawn():
|
||||
var new_global_position = Vector2(distance,0).rotated(randf_range(0.0, 360))
|
||||
new.global_position = new_global_position
|
||||
new.direction = (player.global_position - new_global_position).normalized()
|
||||
new.SPEED = (randf() * 50 + 50) * ( 1 + (global_time / 200))
|
||||
new.SPEED = (randf() * 50 + 50) * ( 1 + (global_time / 100))
|
||||
add_child(new)
|
||||
|
||||
|
||||
|
||||
@@ -245,4 +245,6 @@ Label/font_sizes/font_size = 32
|
||||
Label/fonts/font = ExtResource("1_e1x85")
|
||||
Label/styles/normal = SubResource("StyleBoxFlat_e1x85")
|
||||
PanelContainer/styles/panel = SubResource("StyleBoxFlat_wvktn")
|
||||
ScrollContainer/styles/focus = SubResource("StyleBoxFlat_e1x85")
|
||||
ScrollContainer/styles/panel = SubResource("StyleBoxFlat_e1x85")
|
||||
VBoxContainer/constants/separation = 4
|
||||
|
||||
Reference in New Issue
Block a user