Update #2

Merged
CatAClock merged 3 commits from Update into main 2025-06-10 02:35:57 +00:00
26 changed files with 136 additions and 10 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
# Godot 4
.godot/

View file

@ -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

View file

@ -0,0 +1 @@
uid://ctbgifahg7avv

1
ChessScripts/king.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://bl28ox5spcvmk

View file

@ -0,0 +1 @@
uid://dcfi1tp0xn7wu

1
ChessScripts/pawn.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://duigi305giwc1

View file

@ -0,0 +1 @@
uid://b1ccvyfxyu4aj

1
ChessScripts/rook.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://06yc3abc7mq4

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

33
game.gd
View file

@ -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":
@ -120,6 +118,15 @@ func UpdateGame(cell):
if cell.get_child(0).name == "Rook":
cell.get_child(0).Castling = false
# 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():
# Clearing the arrays
@ -378,4 +385,18 @@ 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 i.get_child_count() != 0:
SelectedNode = str(i.name)
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":
TheNode.get_child(0).modulate = Color(1, 0, 0, 1)

1
game.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://dysg515hr11cc

1
game_win.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://bombmbttl3o7n

1
generator.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://dyqw4lpfqhgmb

View file

@ -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]