diff --git a/game_controller.gd b/game_controller.gd deleted file mode 100644 index b2911e7..0000000 --- a/game_controller.gd +++ /dev/null @@ -1,130 +0,0 @@ -extends Node - -signal player_hit(bool) -signal start_game_one_player -signal start_game_two_player -signal go_to_menu(String) -signal point_gain(int, Vector2) -signal go_to_score_saver(int) - -var is_multiplayer := false -var actual_score := 0 -var score :Score - - -var delay_btw_input = 0.2 -var current_ui = "" -var delay_input := 0.0 - -var music = AudioStreamPlayer.new() -func _music_finished(): - music.play() - -func _ready() -> void: - music.volume_db = -10 - music.autoplay = true - music.play() - music.stream = load("res://audio/exodus.ogg") - music.connect("finished", _music_finished) - add_child(music) - connect("start_game_one_player",start_one_player) - connect("start_game_two_player",start_two_player) - connect("go_to_score_saver", start_score_saver) - connect("go_to_menu", start_menu) - if FileAccess.file_exists("user://Score.res"): - score = ResourceLoader.load("user://Score.res") - else: - score = Score.new() - -func _input(event: InputEvent) -> void: - if event.is_action_pressed("quit"): - get_tree().quit() - elif event is InputEventJoypadMotion: - var array_ui = ["right", "left", "up", "down"] - var max := 0.0 - var max_ui := "" - for ui in array_ui: - if max < Input.get_action_strength(ui): - max = Input.get_action_strength(ui) - max_ui = ui - if max < 0.5 : - delay_input = delay_btw_input - current_ui = "" - else: - current_ui = max_ui - - -func _process(delta: float) -> void: - if current_ui != "": - if delay_input < delay_btw_input: - delay_input += delta - else: - var uiEvent = InputEventAction.new() - uiEvent.action = "ui_" + current_ui - uiEvent.pressed = true - Input.parse_input_event(uiEvent) - delay_input = 0.0 - -func start_one_player()->void: - get_tree().change_scene_to_file("res://scene/main_game.tscn") - -func start_two_player()->void: - is_multiplayer = true - get_tree().change_scene_to_file("res://scene/main_game_2_player.tscn") - -func start_menu(user_name : String)->void: - if is_multiplayer: - var temp = score.score_multiplayer.get(user_name, -1.0) - if temp < actual_score: - score.score_multiplayer[user_name] = actual_score - else: - var temp = score.score_singleplayer.get(user_name, -1.0) - if temp < actual_score: - score.score_singleplayer[user_name] = actual_score - user_name = "" - actual_score = 0 - is_multiplayer = false - score.save() - get_tree().call_deferred("change_scene_to_file", "res://scene/load_screen.tscn") - -func start_score_saver(score: int)->void: - actual_score = score - get_tree().call_deferred("change_scene_to_file", "res://scene/score_saver.tscn") - - -func get_scoreboard_singleplayer(n_lignes: int = 0) -> String: - return _get_scoreboard(score.score_singleplayer, n_lignes) - -func get_scoreboard_multiplayer(n_lignes: int = 0) -> String: - return _get_scoreboard(score.score_multiplayer, n_lignes) - -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"]) - if n_lignes == 0: - n_lignes = clamp( tableau_paires.size(), 5, 1000) - for i in range(clamp(n_lignes, 0, tableau_paires.size())): - text += str(i+1) + ". " + tableau_paires[i]["key"] + " : " + display_score(tableau_paires[i]["value"]) - if i < n_lignes-1: - text+="\n" - if tableau_paires.size() < n_lignes: - for i in range(n_lignes - tableau_paires.size()): - text += str(tableau_paires.size()+ i+1) + ". " + "---- : ----" - if i < n_lignes - tableau_paires.size() -1 : - text += "\n" - return text - -func display_score(score: int) -> String: - var number_str = str(score) - var result = "" - var counter = 0 - - for i in range(number_str.length() - 1, -1, -1): - result = number_str[i] + result - counter += 1 - if counter % 3 == 0 and i != 0: - result = "_" + result - return result diff --git a/game_controller.gd.uid b/game_controller.gd.uid deleted file mode 100644 index b88088a..0000000 --- a/game_controller.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://gvtqgujv723o diff --git a/score.tres b/score.tres deleted file mode 100644 index f5e0ffe..0000000 --- a/score.tres +++ /dev/null @@ -1,6 +0,0 @@ -[gd_resource type="Resource" load_steps=2 format=3 uid="uid://ck6b4fwyamkgd"] - -[ext_resource type="Script" uid="uid://bc77vj158k2e" path="res://script/score.gd" id="1_p2k1x"] - -[resource] -script = ExtResource("1_p2k1x") diff --git a/theme.tres b/theme.tres deleted file mode 100644 index 48ba397..0000000 --- a/theme.tres +++ /dev/null @@ -1,250 +0,0 @@ -[gd_resource type="Theme" load_steps=15 format=3 uid="uid://b46gto6k33wqr"] - -[ext_resource type="FontFile" uid="uid://ck2l6kevep7uq" path="res://assets/Perfect DOS VGA 437.ttf" id="1_e1x85"] - -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_hqigj"] -content_margin_left = 4.0 -content_margin_top = 4.0 -content_margin_right = 4.0 -content_margin_bottom = 4.0 -bg_color = Color(0, 0, 0, 1) -border_color = Color(1, 1, 1, 1) -corner_radius_top_left = 3 -corner_radius_top_right = 3 -corner_radius_bottom_right = 3 -corner_radius_bottom_left = 3 -corner_detail = 5 -expand_margin_left = 12.0 - -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_yin2u"] -content_margin_left = 4.0 -content_margin_top = 4.0 -content_margin_right = 4.0 -content_margin_bottom = 4.0 -bg_color = Color(0, 0, 0, 0) -border_width_left = 4 -border_width_top = 4 -border_width_right = 4 -border_width_bottom = 4 -border_color = Color(1, 1, 1, 1) -corner_detail = 5 -anti_aliasing = false - -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_fsxoa"] -content_margin_left = 4.0 -content_margin_top = 4.0 -content_margin_right = 4.0 -content_margin_bottom = 4.0 -bg_color = Color(0.969137, 0.969137, 0.969137, 0.6) -corner_radius_top_left = 3 -corner_radius_top_right = 3 -corner_radius_bottom_right = 3 -corner_radius_bottom_left = 3 -corner_detail = 5 - -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ybu1x"] -content_margin_left = 4.0 -content_margin_top = 4.0 -content_margin_right = 4.0 -content_margin_bottom = 4.0 -bg_color = Color(0, 0, 0, 1) -corner_radius_top_left = 3 -corner_radius_top_right = 3 -corner_radius_bottom_right = 3 -corner_radius_bottom_left = 3 -corner_detail = 5 - -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_535ge"] -content_margin_left = 4.0 -content_margin_top = 4.0 -content_margin_right = 4.0 -content_margin_bottom = 4.0 -bg_color = Color(1, 1, 1, 1) -corner_radius_top_left = 3 -corner_radius_top_right = 3 -corner_radius_bottom_right = 3 -corner_radius_bottom_left = 3 -corner_detail = 5 - -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_cjfk0"] -content_margin_left = 4.0 -content_margin_top = 4.0 -content_margin_right = 4.0 -content_margin_bottom = 4.0 -bg_color = Color(1, 1, 1, 1) -draw_center = false -border_width_left = 2 -border_width_top = 2 -border_width_right = 2 -border_width_bottom = 2 -corner_radius_top_left = 3 -corner_radius_top_right = 3 -corner_radius_bottom_right = 3 -corner_radius_bottom_left = 3 -corner_detail = 5 -expand_margin_left = 2.0 -expand_margin_top = 2.0 -expand_margin_right = 2.0 -expand_margin_bottom = 2.0 - -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_vj6dk"] -content_margin_left = 4.0 -content_margin_top = 4.0 -content_margin_right = 4.0 -content_margin_bottom = 4.0 -bg_color = Color(1, 1, 1, 0.07) -corner_radius_top_left = 3 -corner_radius_top_right = 3 -corner_radius_bottom_right = 3 -corner_radius_bottom_left = 3 -corner_detail = 5 - -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_110ce"] -content_margin_left = 4.0 -content_margin_top = 4.0 -content_margin_right = 4.0 -content_margin_bottom = 4.0 -bg_color = Color(1, 1, 1, 0.4) -corner_radius_top_left = 3 -corner_radius_top_right = 3 -corner_radius_bottom_right = 3 -corner_radius_bottom_left = 3 -corner_detail = 5 - -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_05tig"] -content_margin_left = 4.0 -content_margin_top = 4.0 -content_margin_right = 4.0 -content_margin_bottom = 4.0 -bg_color = Color(0, 0, 0, 0) -border_width_left = 4 -border_width_top = 4 -border_width_right = 4 -border_width_bottom = 4 -border_color = Color(1, 1, 1, 1) -corner_radius_top_left = 3 -corner_radius_top_right = 3 -corner_radius_bottom_right = 3 -corner_radius_bottom_left = 3 -corner_detail = 5 -expand_margin_left = 4.0 -expand_margin_top = 4.0 -expand_margin_right = 4.0 -expand_margin_bottom = 4.0 - -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_1rmny"] -content_margin_left = 4.0 -content_margin_top = 4.0 -content_margin_right = 4.0 -content_margin_bottom = 4.0 -bg_color = Color(0, 0, 0, 1) -border_width_left = 4 -border_width_top = 4 -border_width_right = 4 -border_width_bottom = 4 -border_color = Color(1, 1, 1, 1) -corner_detail = 5 -anti_aliasing = false - -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_mihib"] -content_margin_left = 4.0 -content_margin_top = 4.0 -content_margin_right = 4.0 -content_margin_bottom = 4.0 -bg_color = Color(0, 0, 0, 0) -border_width_left = 4 -border_width_top = 4 -border_width_right = 4 -border_width_bottom = 4 -border_color = Color(1, 1, 1, 1) -corner_detail = 5 -expand_margin_left = 8.0 -expand_margin_top = 8.0 -expand_margin_right = 8.0 -expand_margin_bottom = 8.0 -anti_aliasing = false - -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_e1x85"] -bg_color = Color(0, 0, 0, 1) -border_width_left = 2 -border_width_top = 2 -border_width_right = 2 -border_width_bottom = 2 -border_color = Color(1, 1, 1, 1) -expand_margin_left = 2.0 -expand_margin_top = 2.0 -expand_margin_right = 2.0 -expand_margin_bottom = 2.0 -anti_aliasing = false - -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_wvktn"] -content_margin_left = 0.0 -content_margin_top = 0.0 -content_margin_right = 0.0 -content_margin_bottom = 0.0 -bg_color = Color(0, 0, 0, 1) -corner_detail = 5 -anti_aliasing = false - -[resource] -Button/colors/font_color = Color(1, 1, 1, 1) -Button/colors/font_disabled_color = Color(0.875, 0.875, 0.875, 0.5) -Button/colors/font_focus_color = Color(0.95, 0.95, 0.95, 1) -Button/colors/font_hover_color = Color(0.95, 0.95, 0.95, 1) -Button/colors/font_hover_pressed_color = Color(1, 1, 1, 1) -Button/colors/font_outline_color = Color(0, 0, 0, 1) -Button/colors/font_pressed_color = Color(1, 1, 1, 1) -Button/colors/icon_disabled_color = Color(1, 1, 1, 0.4) -Button/colors/icon_focus_color = Color(1, 1, 1, 1) -Button/colors/icon_hover_color = Color(1, 1, 1, 1) -Button/colors/icon_hover_pressed_color = Color(1, 1, 1, 1) -Button/colors/icon_normal_color = Color(1, 1, 1, 1) -Button/colors/icon_pressed_color = Color(1, 1, 1, 1) -Button/constants/align_to_largest_stylebox = 0 -Button/constants/h_separation = 4 -Button/constants/icon_max_width = 0 -Button/constants/outline_size = 0 -Button/font_sizes/font_size = 32 -Button/fonts/font = ExtResource("1_e1x85") -Button/styles/disabled = SubResource("StyleBoxFlat_hqigj") -Button/styles/focus = SubResource("StyleBoxFlat_yin2u") -Button/styles/hover = SubResource("StyleBoxFlat_fsxoa") -Button/styles/normal = SubResource("StyleBoxFlat_ybu1x") -Button/styles/pressed = SubResource("StyleBoxFlat_535ge") -ItemList/colors/font_color = Color(1, 1, 1, 1) -ItemList/colors/font_hovered_color = Color(0.95, 0.95, 0.95, 1) -ItemList/colors/font_hovered_selected_color = Color(1, 1, 1, 1) -ItemList/colors/font_outline_color = Color(0, 0, 0, 1) -ItemList/colors/font_selected_color = Color(1, 1, 1, 1) -ItemList/colors/guide_color = Color(0, 0, 0, 0) -ItemList/constants/h_separation = 8 -ItemList/constants/icon_margin = 0 -ItemList/constants/line_separation = 0 -ItemList/constants/outline_size = 0 -ItemList/constants/v_separation = 0 -ItemList/font_sizes/font_size = 64 -ItemList/fonts/font = ExtResource("1_e1x85") -ItemList/styles/cursor = SubResource("StyleBoxFlat_cjfk0") -ItemList/styles/cursor_unfocused = SubResource("StyleBoxFlat_cjfk0") -ItemList/styles/focus = SubResource("StyleBoxFlat_cjfk0") -ItemList/styles/hovered = SubResource("StyleBoxFlat_vj6dk") -ItemList/styles/hovered_selected = SubResource("StyleBoxFlat_110ce") -ItemList/styles/hovered_selected_focus = SubResource("StyleBoxFlat_05tig") -ItemList/styles/panel = SubResource("StyleBoxFlat_1rmny") -ItemList/styles/selected = SubResource("StyleBoxFlat_mihib") -ItemList/styles/selected_focus = SubResource("StyleBoxFlat_mihib") -Label/colors/font_color = Color(1, 1, 1, 1) -Label/colors/font_outline_color = Color(0, 0, 0, 1) -Label/colors/font_shadow_color = Color(0, 0, 0, 0) -Label/constants/line_spacing = 6 -Label/constants/outline_size = 0 -Label/constants/shadow_offset_x = 1 -Label/constants/shadow_offset_y = 1 -Label/constants/shadow_outline_size = 1 -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