From 78231cb17632e624777197021416d5cc659c3528 Mon Sep 17 00:00:00 2001 From: Kyaw Aung <kyawaung0924@gmail.com> Date: Wed, 5 Feb 2025 23:03:52 -0600 Subject: [PATCH] WIP currency implementation --- .godot/editor/editor_layout.cfg | 14 ++++---- ...state-c2a7af834e91ff64325daddf58e45dc0.cfg | 2 +- ...state-3070c538c03ee49b7677ff960a3f5195.cfg | 2 +- .godot/editor/project_metadata.cfg | 4 +-- .godot/editor/script_editor_cache.cfg | 32 +++++++++++++------ scripts/game.gd | 2 +- scripts/run_data/run_data.gd | 13 ++++++-- 7 files changed, 46 insertions(+), 23 deletions(-) diff --git a/.godot/editor/editor_layout.cfg b/.godot/editor/editor_layout.cfg index 6ca1553..c5075b6 100644 --- a/.godot/editor/editor_layout.cfg +++ b/.godot/editor/editor_layout.cfg @@ -18,25 +18,25 @@ dock_filesystem_v_split_offset=0 dock_filesystem_display_mode=0 dock_filesystem_file_sort=0 dock_filesystem_file_list_display_mode=1 -dock_filesystem_selected_paths=PackedStringArray("res://scenes/game.tscn") -dock_filesystem_uncollapsed_paths=PackedStringArray("Favorites", "res://", "res://scripts/", "res://scripts/run_data/", "res://scenes/") +dock_filesystem_selected_paths=PackedStringArray("res://assets/noise/") +dock_filesystem_uncollapsed_paths=PackedStringArray("Favorites", "res://", "res://scripts/run_data/", "res://assets/") dock_3="Scene,Import" dock_4="FileSystem" dock_5="Inspector,Node,History" [EditorNode] -open_scenes=PackedStringArray("res://main.tscn", "res://scenes/scene_manager.tscn", "res://scenes/game.tscn", "res://scenes/ui/pop_up_label.tscn") -current_scene="res://scenes/ui/pop_up_label.tscn" +open_scenes=PackedStringArray("res://main.tscn", "res://scenes/scene_manager.tscn", "res://scenes/game.tscn", "res://scenes/ui/pop_up_label.tscn", "res://scenes/Pawn.tscn") +current_scene="res://scenes/game.tscn" center_split_offset=0 selected_default_debugger_tab_idx=1 selected_main_editor_idx=2 -selected_bottom_panel_item=1 +selected_bottom_panel_item=0 [ScriptEditor] -open_scripts=["res://scripts/game.gd", "res://scripts/main/main.gd", "res://scripts/Pawn.gd", "res://scripts/ui/pop_up_label.gd", "res://scripts/Queen.gd", "res://scripts/run_data/run_data.gd", "res://scripts/scene_manager.gd", "res://scripts/title_screen/title_screen.gd"] -selected_script="res://scripts/ui/pop_up_label.gd" +open_scripts=["res://scripts/Assassin.gd", "res://scripts/game.gd", "res://scripts/main/main.gd", "res://scripts/Pawn.gd", "res://scripts/Piece.gd", "res://scripts/ui/pop_up_label.gd", "res://scripts/Queen.gd", "res://scripts/run_data/run_data.gd", "res://scripts/scene_manager.gd", "res://scripts/title_screen/title_screen.gd"] +selected_script="res://scripts/game.gd" open_help=[] script_split_offset=70 list_split_offset=0 diff --git a/.godot/editor/game.tscn-editstate-c2a7af834e91ff64325daddf58e45dc0.cfg b/.godot/editor/game.tscn-editstate-c2a7af834e91ff64325daddf58e45dc0.cfg index 5fb3678..325e8cf 100644 --- a/.godot/editor/game.tscn-editstate-c2a7af834e91ff64325daddf58e45dc0.cfg +++ b/.godot/editor/game.tscn-editstate-c2a7af834e91ff64325daddf58e45dc0.cfg @@ -175,4 +175,4 @@ Anim={ "zfar": 4000.01, "znear": 0.05 } -selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@16886/@Panel@13/@VBoxContainer@14/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@25/DockVSplitCenter/@VSplitContainer@52/@VBoxContainer@53/@PanelContainer@98/MainScreen/@CanvasItemEditor@9272/@VSplitContainer@9094/@HSplitContainer@9096/@HSplitContainer@9098/@Control@9099/@SubViewportContainer@9100/@SubViewport@9101/Main/SceneManager")]) +selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@16886/@Panel@13/@VBoxContainer@14/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@25/DockVSplitCenter/@VSplitContainer@52/@VBoxContainer@53/@PanelContainer@98/MainScreen/@CanvasItemEditor@9272/@VSplitContainer@9094/@HSplitContainer@9096/@HSplitContainer@9098/@Control@9099/@SubViewportContainer@9100/@SubViewport@9101/Game/PieceContainer")]) diff --git a/.godot/editor/main.tscn-editstate-3070c538c03ee49b7677ff960a3f5195.cfg b/.godot/editor/main.tscn-editstate-3070c538c03ee49b7677ff960a3f5195.cfg index 3cae226..18320f3 100644 --- a/.godot/editor/main.tscn-editstate-3070c538c03ee49b7677ff960a3f5195.cfg +++ b/.godot/editor/main.tscn-editstate-3070c538c03ee49b7677ff960a3f5195.cfg @@ -175,4 +175,4 @@ Anim={ "zfar": 4000.01, "znear": 0.05 } -selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@16886/@Panel@13/@VBoxContainer@14/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@25/DockVSplitCenter/@VSplitContainer@52/@VBoxContainer@53/@PanelContainer@98/MainScreen/@CanvasItemEditor@9272/@VSplitContainer@9094/@HSplitContainer@9096/@HSplitContainer@9098/@Control@9099/@SubViewportContainer@9100/@SubViewport@9101/Main/SceneManager")]) +selected_nodes=Array[NodePath]([]) diff --git a/.godot/editor/project_metadata.cfg b/.godot/editor/project_metadata.cfg index 1dc06d7..14bce7d 100644 --- a/.godot/editor/project_metadata.cfg +++ b/.godot/editor/project_metadata.cfg @@ -11,8 +11,8 @@ create_new_node=Rect2(510, 264, 900, 700) [recent_files] -scenes=["res://scenes/Pawn.tscn", "res://scenes/Queen.tscn", "res://scenes/ui/pop_up_label.tscn", "res://scenes/Assassin.tscn", "res://scenes/game.tscn", "res://scenes/scene_manager.tscn", "res://main.tscn"] -scripts=["res://scripts/main/main.gd", "res://scripts/run_data/run_data.gd", "res://scripts/title_screen/title_screen.gd", "res://scripts/Pawn.gd", "res://scripts/Queen.gd", "res://scripts/ui/pop_up_label.gd", "res://scripts/Assassin.gd", "res://scripts/scene_manager.gd", "res://scripts/game.gd"] +scenes=["res://scenes/Pawn.tscn", "res://scenes/Assassin.tscn", "res://scenes/Queen.tscn", "res://scenes/ui/pop_up_label.tscn", "res://scenes/game.tscn", "res://scenes/scene_manager.tscn", "res://main.tscn"] +scripts=["res://scripts/Piece.gd", "res://scripts/Assassin.gd", "res://scripts/main/main.gd", "res://scripts/run_data/run_data.gd", "res://scripts/title_screen/title_screen.gd", "res://scripts/Pawn.gd", "res://scripts/Queen.gd", "res://scripts/ui/pop_up_label.gd", "res://scripts/scene_manager.gd", "res://scripts/game.gd"] [script_setup] diff --git a/.godot/editor/script_editor_cache.cfg b/.godot/editor/script_editor_cache.cfg index e24010b..116dc81 100644 --- a/.godot/editor/script_editor_cache.cfg +++ b/.godot/editor/script_editor_cache.cfg @@ -3,11 +3,11 @@ state={ "bookmarks": PackedInt32Array(), "breakpoints": PackedInt32Array(), -"column": 29, +"column": 36, "folded_lines": Array[int]([]), "h_scroll_position": 0, -"row": 352, -"scroll_position": 18.0, +"row": 365, +"scroll_position": 345.0, "selection": false, "syntax_highlighter": "GDScript" } @@ -35,7 +35,7 @@ state={ "folded_lines": Array[int]([]), "h_scroll_position": 0, "row": 54, -"scroll_position": 35.0, +"scroll_position": 0.0, "selection": false, "syntax_highlighter": "GDScript" } @@ -63,7 +63,7 @@ state={ "folded_lines": Array[int]([]), "h_scroll_position": 0, "row": 0, -"scroll_position": 87.0, +"scroll_position": 86.0, "selection": false, "syntax_highlighter": "GDScript" } @@ -77,7 +77,7 @@ state={ "folded_lines": Array[int]([]), "h_scroll_position": 0, "row": 0, -"scroll_position": 48.0, +"scroll_position": 33.0, "selection": false, "syntax_highlighter": "GDScript" } @@ -101,11 +101,11 @@ state={ state={ "bookmarks": PackedInt32Array(), "breakpoints": PackedInt32Array(), -"column": 25, +"column": 15, "folded_lines": Array[int]([]), "h_scroll_position": 0, -"row": 11, -"scroll_position": 0.0, +"row": 24, +"scroll_position": 2.0, "selection": false, "syntax_highlighter": "GDScript" } @@ -123,3 +123,17 @@ state={ "selection": false, "syntax_highlighter": "GDScript" } + +[res://scripts/Piece.gd] + +state={ +"bookmarks": PackedInt32Array(), +"breakpoints": PackedInt32Array(), +"column": 0, +"folded_lines": Array[int]([]), +"h_scroll_position": 0, +"row": 0, +"scroll_position": 0.0, +"selection": false, +"syntax_highlighter": "GDScript" +} diff --git a/scripts/game.gd b/scripts/game.gd index d9425ab..57584fd 100644 --- a/scripts/game.gd +++ b/scripts/game.gd @@ -351,7 +351,7 @@ func remove_piece(x,y): explosion_effect.position = child.position + translate() explosion_effect.restart() - + var piece = child.duplicate() if is_opponent(x, y): opponent_piece_count += 1 diff --git a/scripts/run_data/run_data.gd b/scripts/run_data/run_data.gd index a8458d3..425c031 100644 --- a/scripts/run_data/run_data.gd +++ b/scripts/run_data/run_data.gd @@ -2,7 +2,7 @@ extends Node var scene_manager: Node = null -var run_currency: int = 0 +var currency: int = 0 var enchantments: Array = [] var pieces: Array = [] @@ -10,10 +10,19 @@ func _ready() -> void: pass # Replace with function body. func reset_run() -> void: - run_currency = 0 + currency = 0 enchantments.clear() pieces.clear() func start_run(): reset_run() scene_manager.change_scene("res://scenes/game.tscn") + +func add_currency(piece: Node2D) -> void: + var piece_type = piece.get_class() + + if piece is Pawn: + currency += 1 + + print(piece_type) + print("Total currency: ", currency) -- GitLab