From c7bf4a5334e384c85a3d9088f3a630b9cf013fdc Mon Sep 17 00:00:00 2001 From: CatAClock Date: Mon, 9 Jun 2025 12:54:30 -0700 Subject: [PATCH 1/3] update --- .gitignore | 2 ++ Chess.png.import | 6 ++++++ ChessScripts/bishop.gd.uid | 1 + ChessScripts/king.gd.uid | 1 + ChessScripts/knight.gd.uid | 1 + ChessScripts/pawn.gd.uid | 1 + ChessScripts/queen.gd.uid | 1 + ChessScripts/rook.gd.uid | 1 + ChessTextures/BBishop.svg.import | 6 ++++++ ChessTextures/BKing.svg.import | 6 ++++++ ChessTextures/BKnight.svg.import | 6 ++++++ ChessTextures/BPawn.svg.import | 6 ++++++ ChessTextures/BQueen.svg.import | 6 ++++++ ChessTextures/BRook.svg.import | 6 ++++++ ChessTextures/WBishop.svg.import | 6 ++++++ ChessTextures/WKing.svg.import | 6 ++++++ ChessTextures/WKnight.svg.import | 6 ++++++ ChessTextures/WPawn.svg.import | 6 ++++++ ChessTextures/WQueen.svg.import | 6 ++++++ ChessTextures/WRook.svg.import | 6 ++++++ game.gd.uid | 1 + game_win.gd.uid | 1 + generator.gd.uid | 1 + project.godot | 2 +- 24 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 ChessScripts/bishop.gd.uid create mode 100644 ChessScripts/king.gd.uid create mode 100644 ChessScripts/knight.gd.uid create mode 100644 ChessScripts/pawn.gd.uid create mode 100644 ChessScripts/queen.gd.uid create mode 100644 ChessScripts/rook.gd.uid create mode 100644 game.gd.uid create mode 100644 game_win.gd.uid create mode 100644 generator.gd.uid diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..63bb5dc --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# Godot 4 +.godot/ diff --git a/Chess.png.import b/Chess.png.import index 648d333..72367d3 100644 --- a/Chess.png.import +++ b/Chess.png.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/Chess.png-5aa5e1cd7f41db7e12bcda3ac0b5924e.ct compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/ChessScripts/bishop.gd.uid b/ChessScripts/bishop.gd.uid new file mode 100644 index 0000000..65d568f --- /dev/null +++ b/ChessScripts/bishop.gd.uid @@ -0,0 +1 @@ +uid://ctbgifahg7avv diff --git a/ChessScripts/king.gd.uid b/ChessScripts/king.gd.uid new file mode 100644 index 0000000..f17850a --- /dev/null +++ b/ChessScripts/king.gd.uid @@ -0,0 +1 @@ +uid://bl28ox5spcvmk diff --git a/ChessScripts/knight.gd.uid b/ChessScripts/knight.gd.uid new file mode 100644 index 0000000..75504c1 --- /dev/null +++ b/ChessScripts/knight.gd.uid @@ -0,0 +1 @@ +uid://dcfi1tp0xn7wu diff --git a/ChessScripts/pawn.gd.uid b/ChessScripts/pawn.gd.uid new file mode 100644 index 0000000..c8941bc --- /dev/null +++ b/ChessScripts/pawn.gd.uid @@ -0,0 +1 @@ +uid://duigi305giwc1 diff --git a/ChessScripts/queen.gd.uid b/ChessScripts/queen.gd.uid new file mode 100644 index 0000000..a6b930e --- /dev/null +++ b/ChessScripts/queen.gd.uid @@ -0,0 +1 @@ +uid://b1ccvyfxyu4aj diff --git a/ChessScripts/rook.gd.uid b/ChessScripts/rook.gd.uid new file mode 100644 index 0000000..aa1e695 --- /dev/null +++ b/ChessScripts/rook.gd.uid @@ -0,0 +1 @@ +uid://06yc3abc7mq4 diff --git a/ChessTextures/BBishop.svg.import b/ChessTextures/BBishop.svg.import index bcf0cae..cabd8be 100644 --- a/ChessTextures/BBishop.svg.import +++ b/ChessTextures/BBishop.svg.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/BBishop.svg-32bac95d5ec3d4b5dc48860fe70db198. compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/ChessTextures/BKing.svg.import b/ChessTextures/BKing.svg.import index de2fa0b..e51806a 100644 --- a/ChessTextures/BKing.svg.import +++ b/ChessTextures/BKing.svg.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/BKing.svg-0e68d73bd48c1cf0da8d58870c0d70fe.ct compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/ChessTextures/BKnight.svg.import b/ChessTextures/BKnight.svg.import index 9b7bad5..c06db99 100644 --- a/ChessTextures/BKnight.svg.import +++ b/ChessTextures/BKnight.svg.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/BKnight.svg-ab901432cba73437ff587bc1c6ca9974. compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/ChessTextures/BPawn.svg.import b/ChessTextures/BPawn.svg.import index b3df98f..d52ce10 100644 --- a/ChessTextures/BPawn.svg.import +++ b/ChessTextures/BPawn.svg.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/BPawn.svg-89a4238a9f63fa634c3ae4588a7dfe4b.ct compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/ChessTextures/BQueen.svg.import b/ChessTextures/BQueen.svg.import index af80285..1c90be8 100644 --- a/ChessTextures/BQueen.svg.import +++ b/ChessTextures/BQueen.svg.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/BQueen.svg-0f0716f66c779cdea1fabbd0a87d627a.c compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/ChessTextures/BRook.svg.import b/ChessTextures/BRook.svg.import index 570df76..e561395 100644 --- a/ChessTextures/BRook.svg.import +++ b/ChessTextures/BRook.svg.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/BRook.svg-6b13852aba3b5f99b355465e2aa624fd.ct compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/ChessTextures/WBishop.svg.import b/ChessTextures/WBishop.svg.import index 34887c8..5473333 100644 --- a/ChessTextures/WBishop.svg.import +++ b/ChessTextures/WBishop.svg.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/WBishop.svg-686706903502a95cd46cd77a78ee9440. compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/ChessTextures/WKing.svg.import b/ChessTextures/WKing.svg.import index e2a814b..b9d462e 100644 --- a/ChessTextures/WKing.svg.import +++ b/ChessTextures/WKing.svg.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/WKing.svg-5baf29b7cc0647974c7427255174f754.ct compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/ChessTextures/WKnight.svg.import b/ChessTextures/WKnight.svg.import index 6fe0808..79ecf70 100644 --- a/ChessTextures/WKnight.svg.import +++ b/ChessTextures/WKnight.svg.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/WKnight.svg-77361976620fc1216b47056d5a4529b1. compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/ChessTextures/WPawn.svg.import b/ChessTextures/WPawn.svg.import index af0cb6c..a5ddfc2 100644 --- a/ChessTextures/WPawn.svg.import +++ b/ChessTextures/WPawn.svg.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/WPawn.svg-b837731bbfbbbf8bc72cb8688f8b3a79.ct compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/ChessTextures/WQueen.svg.import b/ChessTextures/WQueen.svg.import index 2eee640..94decdf 100644 --- a/ChessTextures/WQueen.svg.import +++ b/ChessTextures/WQueen.svg.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/WQueen.svg-0bb76d6b190776365484fd4d31df0913.c compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/ChessTextures/WRook.svg.import b/ChessTextures/WRook.svg.import index 2543059..88a56da 100644 --- a/ChessTextures/WRook.svg.import +++ b/ChessTextures/WRook.svg.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/WRook.svg-39b447f94ad3647c8bc4cff26af8747b.ct compress/mode=0 compress/high_quality=false compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ mipmaps/generate=false mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 process/fix_alpha_border=true process/premult_alpha=false process/normal_map_invert_y=false diff --git a/game.gd.uid b/game.gd.uid new file mode 100644 index 0000000..05f8fa9 --- /dev/null +++ b/game.gd.uid @@ -0,0 +1 @@ +uid://dysg515hr11cc diff --git a/game_win.gd.uid b/game_win.gd.uid new file mode 100644 index 0000000..78239f6 --- /dev/null +++ b/game_win.gd.uid @@ -0,0 +1 @@ +uid://bombmbttl3o7n diff --git a/generator.gd.uid b/generator.gd.uid new file mode 100644 index 0000000..990229f --- /dev/null +++ b/generator.gd.uid @@ -0,0 +1 @@ +uid://dyqw4lpfqhgmb diff --git a/project.godot b/project.godot index b142325..2ac1a81 100644 --- a/project.godot +++ b/project.godot @@ -13,7 +13,7 @@ config_version=5 config/name="Godot Chess" config/description="The classic game of Chess in Godot Engine" run/main_scene="res://board.tscn" -config/features=PackedStringArray("4.3", "Forward Plus") +config/features=PackedStringArray("4.5", "Forward Plus") config/icon="res://Chess.png" [editor_plugins] -- 2.45.3 From a59412eb6066cf8095f35c785d883d6696012eee Mon Sep 17 00:00:00 2001 From: CatAClock Date: Mon, 9 Jun 2025 13:38:06 -0700 Subject: [PATCH 2/3] progress --- game.gd | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/game.gd b/game.gd index 6e4bf98..6e376f1 100644 --- a/game.gd +++ b/game.gd @@ -119,6 +119,9 @@ func UpdateGame(cell): cell.get_child(0).Castling = false if cell.get_child(0).name == "Rook": cell.get_child(0).Castling = false + + # King checking. + CheckKing(things) # Below is the movement that is used for the pieces func GetMovableAreas(): @@ -378,4 +381,19 @@ func IsNull(Location): if Flow.get_node_or_null(Location) == null: return true else: + IsKing(Location) return false + +# Checking for a king. +func CheckKing(Children): + for i in Children: + if not IsNull(i.get_path()): + SelectedNode = str(i.name) + print(SelectedNode) + GetMovableAreas() + +# Helper function +func IsKing(Location): + var TheNode = Flow.get_node_or_null(Location) + if TheNode != null && TheNode.get_child_count() != 0 && TheNode.get_child(0).PieceColor != Turn && TheNode.get_child(0).name == "King": + print("Check!"); -- 2.45.3 From ec7b2cbd12388391cbc054a667f5c7a48e3a4adf Mon Sep 17 00:00:00 2001 From: CatAClock Date: Mon, 9 Jun 2025 19:29:07 -0700 Subject: [PATCH 3/3] Access & Check --- board.tscn | 22 +++++++++++++++++++--- game.gd | 21 ++++++++++++--------- 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/board.tscn b/board.tscn index 5415378..300345b 100644 --- a/board.tscn +++ b/board.tscn @@ -1,16 +1,18 @@ [gd_scene load_steps=10 format=3 uid="uid://d0qyk6v20uief"] -[ext_resource type="Script" path="res://generator.gd" id="1_ckrtr"] -[ext_resource type="Script" path="res://game.gd" id="1_f1l42"] +[ext_resource type="Script" uid="uid://dyqw4lpfqhgmb" path="res://generator.gd" id="1_ckrtr"] +[ext_resource type="Script" uid="uid://dysg515hr11cc" path="res://game.gd" id="1_f1l42"] [ext_resource type="PackedScene" uid="uid://dl8ctpb4nx5b4" path="res://ChessScenes/pawn.tscn" id="3_871tv"] [ext_resource type="PackedScene" uid="uid://cu208w2aj6qnh" path="res://ChessScenes/bishop.tscn" id="4_f2vpi"] [ext_resource type="PackedScene" uid="uid://cl7imfd1umhvu" path="res://ChessScenes/rook.tscn" id="5_lwy4i"] [ext_resource type="PackedScene" uid="uid://bgd6ldfcm8hie" path="res://ChessScenes/knight.tscn" id="6_ta68t"] [ext_resource type="PackedScene" uid="uid://1sle88win6dm" path="res://ChessScenes/queen.tscn" id="7_7creb"] [ext_resource type="PackedScene" uid="uid://yqfgmt234xui" path="res://ChessScenes/king.tscn" id="8_vvr6q"] -[ext_resource type="Script" path="res://game_win.gd" id="9_ww6wk"] +[ext_resource type="Script" uid="uid://bombmbttl3o7n" path="res://game_win.gd" id="9_ww6wk"] [node name="Board" type="Control"] +accessibility_name = "Root" +accessibility_description = "The node that houses everything." layout_mode = 3 anchors_preset = 0 offset_right = 40.0 @@ -19,6 +21,8 @@ script = ExtResource("1_f1l42") BoardPath = NodePath("Flow") [node name="Flow" type="FlowContainer" parent="."] +accessibility_name = "Flow" +accessibility_description = "The game board" layout_mode = 0 script = ExtResource("1_ckrtr") Pawn = ExtResource("3_871tv") @@ -29,12 +33,16 @@ Queen = ExtResource("7_7creb") King = ExtResource("8_vvr6q") [node name="GameWin" type="Control" parent="."] +accessibility_name = "Win" +accessibility_description = "Node that houses a script." anchors_preset = 0 offset_right = 40.0 offset_bottom = 40.0 script = ExtResource("9_ww6wk") [node name="Promotion" type="Panel" parent="."] +accessibility_name = "Promotion" +accessibility_description = "A panel that houses buttons for promoting." visible = false layout_mode = 0 offset_left = 531.0 @@ -43,6 +51,8 @@ offset_right = 731.0 offset_bottom = 330.0 [node name="Rook" type="Button" parent="Promotion"] +accessibility_name = "Rook" +accessibility_description = "Promote a pawn to a rook." layout_mode = 0 offset_left = 8.0 offset_top = 10.0 @@ -51,6 +61,8 @@ offset_bottom = 41.0 text = "Rook" [node name="Bishop" type="Button" parent="Promotion"] +accessibility_name = "Bishop" +accessibility_description = "Promote a pawn to a bishop." layout_mode = 0 offset_left = 68.0 offset_top = 10.0 @@ -59,6 +71,8 @@ offset_bottom = 41.0 text = "Bishop" [node name="Knight" type="Button" parent="Promotion"] +accessibility_name = "Knight" +accessibility_description = "Promote a pawn to a knight." layout_mode = 0 offset_left = 9.0 offset_top = 50.0 @@ -67,6 +81,8 @@ offset_bottom = 81.0 text = "Knight" [node name="Queen" type="Button" parent="Promotion"] +accessibility_name = "Queen" +accessibility_description = "Promote a pawn to a queen." layout_mode = 0 offset_left = 79.0 offset_top = 52.0 diff --git a/game.gd b/game.gd index 6e376f1..d48651d 100644 --- a/game.gd +++ b/game.gd @@ -98,16 +98,14 @@ func _on_flow_send_location(Location: String): func UpdateGame(cell): SelectedNode = "" - if Turn == 0: - Turn = 1 - else: - Turn = 0 - - # get the en-passantable pieces and undo them var things = Flow.get_children() + # get the en-passantable pieces and undo them for i in things: if i.get_child_count() != 0 && i.get_child(0).name == "Pawn" && i.get_child(0).PieceColor == Turn && i.get_child(0).EnPassant == true: i.get_child(0).EnPassant = false + # This changes the color to regular white. For kings. + elif i.get_child_count() != 0: + i.get_child(0).modulate = Color(1, 1, 1, 1) # Remove and add the abilities once they are either used or not used if cell.get_child(0).name == "Pawn": @@ -122,6 +120,12 @@ func UpdateGame(cell): # King checking. CheckKing(things) + SelectedNode = "" + + if Turn == 0: + Turn = 1 + else: + Turn = 0 # Below is the movement that is used for the pieces func GetMovableAreas(): @@ -387,13 +391,12 @@ func IsNull(Location): # Checking for a king. func CheckKing(Children): for i in Children: - if not IsNull(i.get_path()): + if i.get_child_count() != 0: SelectedNode = str(i.name) - print(SelectedNode) GetMovableAreas() # Helper function func IsKing(Location): var TheNode = Flow.get_node_or_null(Location) if TheNode != null && TheNode.get_child_count() != 0 && TheNode.get_child(0).PieceColor != Turn && TheNode.get_child(0).name == "King": - print("Check!"); + TheNode.get_child(0).modulate = Color(1, 0, 0, 1) -- 2.45.3