codeberg copy

This commit is contained in:
CatAClock 2025-04-15 11:52:21 -07:00
commit 45122b5175
43 changed files with 1413 additions and 0 deletions

BIN
Chess.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

34
Chess.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bphl4a8t8l0h7"
path="res://.godot/imported/Chess.png-5aa5e1cd7f41db7e12bcda3ac0b5924e.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Chess.png"
dest_files=["res://.godot/imported/Chess.png-5aa5e1cd7f41db7e12bcda3ac0b5924e.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

10
ChessScenes/bishop.tscn Normal file
View file

@ -0,0 +1,10 @@
[gd_scene load_steps=4 format=3 uid="uid://cu208w2aj6qnh"]
[ext_resource type="Script" path="res://ChessScripts/bishop.gd" id="1_b0tyd"]
[ext_resource type="Texture2D" uid="uid://ca8t2shoassp2" path="res://ChessTextures/BBishop.svg" id="2_fvtue"]
[ext_resource type="Texture2D" uid="uid://bal1cx2x7hk7l" path="res://ChessTextures/WBishop.svg" id="3_i6xfw"]
[node name="Bishop" type="Sprite2D"]
script = ExtResource("1_b0tyd")
Black = ExtResource("2_fvtue")
White = ExtResource("3_i6xfw")

10
ChessScenes/king.tscn Normal file
View file

@ -0,0 +1,10 @@
[gd_scene load_steps=4 format=3 uid="uid://yqfgmt234xui"]
[ext_resource type="Script" path="res://ChessScripts/king.gd" id="1_88uxw"]
[ext_resource type="Texture2D" uid="uid://b8e8353pyae4l" path="res://ChessTextures/BKing.svg" id="2_xat25"]
[ext_resource type="Texture2D" uid="uid://bgeifkewhw83q" path="res://ChessTextures/WKing.svg" id="3_rg8iu"]
[node name="King" type="Sprite2D"]
script = ExtResource("1_88uxw")
Black = ExtResource("2_xat25")
White = ExtResource("3_rg8iu")

10
ChessScenes/knight.tscn Normal file
View file

@ -0,0 +1,10 @@
[gd_scene load_steps=4 format=3 uid="uid://bgd6ldfcm8hie"]
[ext_resource type="Script" path="res://ChessScripts/knight.gd" id="1_7qao2"]
[ext_resource type="Texture2D" uid="uid://bjneg3fh7mu2e" path="res://ChessTextures/BKnight.svg" id="2_2w5jy"]
[ext_resource type="Texture2D" uid="uid://dnp45xyp0eesa" path="res://ChessTextures/WKnight.svg" id="3_jfjqj"]
[node name="Knight" type="Sprite2D"]
script = ExtResource("1_7qao2")
Black = ExtResource("2_2w5jy")
White = ExtResource("3_jfjqj")

10
ChessScenes/pawn.tscn Normal file
View file

@ -0,0 +1,10 @@
[gd_scene load_steps=4 format=3 uid="uid://dl8ctpb4nx5b4"]
[ext_resource type="Script" path="res://ChessScripts/pawn.gd" id="1_2dlbf"]
[ext_resource type="Texture2D" uid="uid://1sql4pmy32c8" path="res://ChessTextures/BPawn.svg" id="2_ucadg"]
[ext_resource type="Texture2D" uid="uid://dl5dp47xg34sb" path="res://ChessTextures/WPawn.svg" id="3_n7bwu"]
[node name="Pawn" type="Sprite2D"]
script = ExtResource("1_2dlbf")
Black = ExtResource("2_ucadg")
White = ExtResource("3_n7bwu")

10
ChessScenes/queen.tscn Normal file
View file

@ -0,0 +1,10 @@
[gd_scene load_steps=4 format=3 uid="uid://1sle88win6dm"]
[ext_resource type="Script" path="res://ChessScripts/queen.gd" id="1_djmia"]
[ext_resource type="Texture2D" uid="uid://cla2mshxp0elx" path="res://ChessTextures/BQueen.svg" id="2_grtjk"]
[ext_resource type="Texture2D" uid="uid://cr1lku07l36wb" path="res://ChessTextures/WQueen.svg" id="3_fvleu"]
[node name="Queen" type="Sprite2D"]
script = ExtResource("1_djmia")
Black = ExtResource("2_grtjk")
White = ExtResource("3_fvleu")

10
ChessScenes/rook.tscn Normal file
View file

@ -0,0 +1,10 @@
[gd_scene load_steps=4 format=3 uid="uid://cl7imfd1umhvu"]
[ext_resource type="Script" path="res://ChessScripts/rook.gd" id="1_cx1v1"]
[ext_resource type="Texture2D" uid="uid://2an2oqh0ks1y" path="res://ChessTextures/BRook.svg" id="2_yjf4y"]
[ext_resource type="Texture2D" uid="uid://qisaumos7b53" path="res://ChessTextures/WRook.svg" id="3_vp7br"]
[node name="Rook" type="Sprite2D"]
script = ExtResource("1_cx1v1")
Black = ExtResource("2_yjf4y")
White = ExtResource("3_vp7br")

14
ChessScripts/bishop.gd Normal file
View file

@ -0,0 +1,14 @@
extends Sprite2D
# Standard
var PieceColor: int
@export var Black: CompressedTexture2D
@export var White: CompressedTexture2D
func Spawned(color: int):
if color == 0:
self.texture = White
PieceColor = 0
else:
self.texture = Black
PieceColor = 1

17
ChessScripts/king.gd Normal file
View file

@ -0,0 +1,17 @@
extends Sprite2D
# Extra ablilities
var Castling = true
# Standard
var PieceColor: int
@export var Black: CompressedTexture2D
@export var White: CompressedTexture2D
func Spawned(color: int):
if color == 0:
self.texture = White
PieceColor = 0
else:
self.texture = Black
PieceColor = 1

14
ChessScripts/knight.gd Normal file
View file

@ -0,0 +1,14 @@
extends Sprite2D
# Standard
var PieceColor: int
@export var Black: CompressedTexture2D
@export var White: CompressedTexture2D
func Spawned(color: int):
if color == 0:
self.texture = White
PieceColor = 0
else:
self.texture = Black
PieceColor = 1

18
ChessScripts/pawn.gd Normal file
View file

@ -0,0 +1,18 @@
extends Sprite2D
# Extra ablilities
var DoubleStart = true
var EnPassant = false
# Standard
var PieceColor: int
@export var Black: CompressedTexture2D
@export var White: CompressedTexture2D
func Spawned(color: int):
if color == 0:
self.texture = White
PieceColor = 0
else:
self.texture = Black
PieceColor = 1

14
ChessScripts/queen.gd Normal file
View file

@ -0,0 +1,14 @@
extends Sprite2D
# Standard
var PieceColor: int
@export var Black: CompressedTexture2D
@export var White: CompressedTexture2D
func Spawned(color: int):
if color == 0:
self.texture = White
PieceColor = 0
else:
self.texture = Black
PieceColor = 1

17
ChessScripts/rook.gd Normal file
View file

@ -0,0 +1,17 @@
extends Sprite2D
# Extra ablilities
var Castling = true
# Standard
var PieceColor: int
@export var Black: CompressedTexture2D
@export var White: CompressedTexture2D
func Spawned(color: int):
if color == 0:
self.texture = White
PieceColor = 0
else:
self.texture = Black
PieceColor = 1

12
ChessTextures/BBishop.svg Normal file
View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="45" height="45">
<g style="opacity:1; fill:none; fill-rule:evenodd; fill-opacity:1; stroke:#000000; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round; stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;" transform="translate(0,0.6)">
<g style="fill:#000000; stroke:#000000; stroke-linecap:butt;">
<path d="M 9,36 C 12.39,35.03 19.11,36.43 22.5,34 C 25.89,36.43 32.61,35.03 36,36 C 36,36 37.65,36.54 39,38 C 38.32,38.97 37.35,38.99 36,38.5 C 32.61,37.53 25.89,38.96 22.5,37.5 C 19.11,38.96 12.39,37.53 9,38.5 C 7.65,38.99 6.68,38.97 6,38 C 7.35,36.54 9,36 9,36 z"/>
<path d="M 15,32 C 17.5,34.5 27.5,34.5 30,32 C 30.5,30.5 30,30 30,30 C 30,27.5 27.5,26 27.5,26 C 33,24.5 33.5,14.5 22.5,10.5 C 11.5,14.5 12,24.5 17.5,26 C 17.5,26 15,27.5 15,30 C 15,30 14.5,30.5 15,32 z"/>
<path d="M 25 8 A 2.5 2.5 0 1 1 20,8 A 2.5 2.5 0 1 1 25 8 z"/>
</g>
<path d="M 17.5,26 L 27.5,26 M 15,30 L 30,30 M 22.5,15.5 L 22.5,20.5 M 20,18 L 25,18" style="fill:none; stroke:#ffffff; stroke-linejoin:miter;"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://ca8t2shoassp2"
path="res://.godot/imported/BBishop.svg-32bac95d5ec3d4b5dc48860fe70db198.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://ChessTextures/BBishop.svg"
dest_files=["res://.godot/imported/BBishop.svg-32bac95d5ec3d4b5dc48860fe70db198.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
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

12
ChessTextures/BKing.svg Normal file
View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="45" height="45">
<g style="fill:none; fill-opacity:1; fill-rule:evenodd; stroke:#000000; stroke-width:1.5; stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;">
<path d="M 22.5,11.63 L 22.5,6" style="fill:none; stroke:#000000; stroke-linejoin:miter;" id="path6570"/>
<path d="M 22.5,25 C 22.5,25 27,17.5 25.5,14.5 C 25.5,14.5 24.5,12 22.5,12 C 20.5,12 19.5,14.5 19.5,14.5 C 18,17.5 22.5,25 22.5,25" style="fill:#000000;fill-opacity:1; stroke-linecap:butt; stroke-linejoin:miter;"/>
<path d="M 12.5,37 C 18,40.5 27,40.5 32.5,37 L 32.5,30 C 32.5,30 41.5,25.5 38.5,19.5 C 34.5,13 25,16 22.5,23.5 L 22.5,27 L 22.5,23.5 C 20,16 10.5,13 6.5,19.5 C 3.5,25.5 12.5,30 12.5,30 L 12.5,37" style="fill:#000000; stroke:#000000;"/>
<path d="M 20,8 L 25,8" style="fill:none; stroke:#000000; stroke-linejoin:miter;"/>
<path d="M 32,29.5 C 32,29.5 40.5,25.5 38.03,19.85 C 34.15,14 25,18 22.5,24.5 L 22.5,26.6 L 22.5,24.5 C 20,18 10.85,14 6.97,19.85 C 4.5,25.5 13,29.5 13,29.5" style="fill:none; stroke:#ffffff;"/>
<path d="M 12.5,30 C 18,27 27,27 32.5,30 M 12.5,33.5 C 18,30.5 27,30.5 32.5,33.5 M 12.5,37 C 18,34 27,34 32.5,37" style="fill:none; stroke:#ffffff;"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b8e8353pyae4l"
path="res://.godot/imported/BKing.svg-0e68d73bd48c1cf0da8d58870c0d70fe.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://ChessTextures/BKing.svg"
dest_files=["res://.godot/imported/BKing.svg-0e68d73bd48c1cf0da8d58870c0d70fe.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
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

22
ChessTextures/BKnight.svg Normal file
View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="45" height="45">
<g style="opacity:1; fill:none; fill-opacity:1; fill-rule:evenodd; stroke:#000000; stroke-width:1.5; stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;" transform="translate(0,0.3)">
<path
d="M 22,10 C 32.5,11 38.5,18 38,39 L 15,39 C 15,30 25,32.5 23,18"
style="fill:#000000; stroke:#000000;" />
<path
d="M 24,18 C 24.38,20.91 18.45,25.37 16,27 C 13,29 13.18,31.34 11,31 C 9.958,30.06 12.41,27.96 11,28 C 10,28 11.19,29.23 10,30 C 9,30 5.997,31 6,26 C 6,24 12,14 12,14 C 12,14 13.89,12.1 14,10.5 C 13.27,9.506 13.5,8.5 13.5,7.5 C 14.5,6.5 16.5,10 16.5,10 L 18.5,10 C 18.5,10 19.28,8.008 21,7 C 22,7 22,10 22,10"
style="fill:#000000; stroke:#000000;" />
<path
d="M 9.5 25.5 A 0.5 0.5 0 1 1 8.5,25.5 A 0.5 0.5 0 1 1 9.5 25.5 z"
style="fill:#ffffff; stroke:#ffffff;" />
<path
d="M 15 15.5 A 0.5 1.5 0 1 1 14,15.5 A 0.5 1.5 0 1 1 15 15.5 z"
transform="matrix(0.866,0.5,-0.5,0.866,9.693,-5.173)"
style="fill:#ffffff; stroke:#ffffff;" />
<path
d="M 24.55,10.4 L 24.1,11.85 L 24.6,12 C 27.75,13 30.25,14.49 32.5,18.75 C 34.75,23.01 35.75,29.06 35.25,39 L 35.2,39.5 L 37.45,39.5 L 37.5,39 C 38,28.94 36.62,22.15 34.25,17.66 C 31.88,13.17 28.46,11.02 25.06,10.5 L 24.55,10.4 z "
style="fill:#ffffff; stroke:none;" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bjneg3fh7mu2e"
path="res://.godot/imported/BKnight.svg-ab901432cba73437ff587bc1c6ca9974.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://ChessTextures/BKnight.svg"
dest_files=["res://.godot/imported/BKnight.svg-ab901432cba73437ff587bc1c6ca9974.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
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

5
ChessTextures/BPawn.svg Normal file
View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="45" height="45">
<path d="m 22.5,9 c -2.21,0 -4,1.79 -4,4 0,0.89 0.29,1.71 0.78,2.38 C 17.33,16.5 16,18.59 16,21 c 0,2.03 0.94,3.84 2.41,5.03 C 15.41,27.09 11,31.58 11,39.5 H 34 C 34,31.58 29.59,27.09 26.59,26.03 28.06,24.84 29,23.03 29,21 29,18.59 27.67,16.5 25.72,15.38 26.21,14.71 26.5,13.89 26.5,13 c 0,-2.21 -1.79,-4 -4,-4 z" style="opacity:1; fill:#000000; fill-opacity:1; fill-rule:nonzero; stroke:#000000; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:miter; stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;"/>
</svg>

After

Width:  |  Height:  |  Size: 766 B

View file

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://1sql4pmy32c8"
path="res://.godot/imported/BPawn.svg-89a4238a9f63fa634c3ae4588a7dfe4b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://ChessTextures/BPawn.svg"
dest_files=["res://.godot/imported/BPawn.svg-89a4238a9f63fa634c3ae4588a7dfe4b.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
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

27
ChessTextures/BQueen.svg Normal file
View file

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="45"
height="45">
<g style="fill:#000000;stroke:#000000;stroke-width:1.5; stroke-linecap:round;stroke-linejoin:round">
<path d="M 9,26 C 17.5,24.5 30,24.5 36,26 L 38.5,13.5 L 31,25 L 30.7,10.9 L 25.5,24.5 L 22.5,10 L 19.5,24.5 L 14.3,10.9 L 14,25 L 6.5,13.5 L 9,26 z"
style="stroke-linecap:butt;fill:#000000" />
<path d="m 9,26 c 0,2 1.5,2 2.5,4 1,1.5 1,1 0.5,3.5 -1.5,1 -1,2.5 -1,2.5 -1.5,1.5 0,2.5 0,2.5 6.5,1 16.5,1 23,0 0,0 1.5,-1 0,-2.5 0,0 0.5,-1.5 -1,-2.5 -0.5,-2.5 -0.5,-2 0.5,-3.5 1,-2 2.5,-2 2.5,-4 -8.5,-1.5 -18.5,-1.5 -27,0 z" />
<path d="M 11.5,30 C 15,29 30,29 33.5,30" />
<path d="m 12,33.5 c 6,-1 15,-1 21,0" />
<circle cx="6" cy="12" r="2" />
<circle cx="14" cy="9" r="2" />
<circle cx="22.5" cy="8" r="2" />
<circle cx="31" cy="9" r="2" />
<circle cx="39" cy="12" r="2" />
<path d="M 11,38.5 A 35,35 1 0 0 34,38.5"
style="fill:none; stroke:#000000;stroke-linecap:butt;" />
<g style="fill:none; stroke:#ffffff;">
<path d="M 11,29 A 35,35 1 0 1 34,29" />
<path d="M 12.5,31.5 L 32.5,31.5" />
<path d="M 11.5,34.5 A 35,35 1 0 0 33.5,34.5" />
<path d="M 10.5,37.5 A 35,35 1 0 0 34.5,37.5" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cla2mshxp0elx"
path="res://.godot/imported/BQueen.svg-0f0716f66c779cdea1fabbd0a87d627a.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://ChessTextures/BQueen.svg"
dest_files=["res://.godot/imported/BQueen.svg-0f0716f66c779cdea1fabbd0a87d627a.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
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

39
ChessTextures/BRook.svg Normal file
View file

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="45" height="45">
<g style="opacity:1; fill:#000000; fill-opacity:1; fill-rule:evenodd; stroke:#000000; stroke-width:1.5; stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;" transform="translate(0,0.3)">
<path
d="M 9,39 L 36,39 L 36,36 L 9,36 L 9,39 z "
style="stroke-linecap:butt;" />
<path
d="M 12.5,32 L 14,29.5 L 31,29.5 L 32.5,32 L 12.5,32 z "
style="stroke-linecap:butt;" />
<path
d="M 12,36 L 12,32 L 33,32 L 33,36 L 12,36 z "
style="stroke-linecap:butt;" />
<path
d="M 14,29.5 L 14,16.5 L 31,16.5 L 31,29.5 L 14,29.5 z "
style="stroke-linecap:butt;stroke-linejoin:miter;" />
<path
d="M 14,16.5 L 11,14 L 34,14 L 31,16.5 L 14,16.5 z "
style="stroke-linecap:butt;" />
<path
d="M 11,14 L 11,9 L 15,9 L 15,11 L 20,11 L 20,9 L 25,9 L 25,11 L 30,11 L 30,9 L 34,9 L 34,14 L 11,14 z "
style="stroke-linecap:butt;" />
<path
d="M 12,35.5 L 33,35.5 L 33,35.5"
style="fill:none; stroke:#ffffff; stroke-width:1; stroke-linejoin:miter;" />
<path
d="M 13,31.5 L 32,31.5"
style="fill:none; stroke:#ffffff; stroke-width:1; stroke-linejoin:miter;" />
<path
d="M 14,29.5 L 31,29.5"
style="fill:none; stroke:#ffffff; stroke-width:1; stroke-linejoin:miter;" />
<path
d="M 14,16.5 L 31,16.5"
style="fill:none; stroke:#ffffff; stroke-width:1; stroke-linejoin:miter;" />
<path
d="M 11,14 L 34,14"
style="fill:none; stroke:#ffffff; stroke-width:1; stroke-linejoin:miter;" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://2an2oqh0ks1y"
path="res://.godot/imported/BRook.svg-6b13852aba3b5f99b355465e2aa624fd.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://ChessTextures/BRook.svg"
dest_files=["res://.godot/imported/BRook.svg-6b13852aba3b5f99b355465e2aa624fd.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
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

12
ChessTextures/WBishop.svg Normal file
View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="45" height="45">
<g style="opacity:1; fill:none; fill-rule:evenodd; fill-opacity:1; stroke:#000000; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round; stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;" transform="translate(0,0.6)">
<g style="fill:#ffffff; stroke:#000000; stroke-linecap:butt;">
<path d="M 9,36 C 12.39,35.03 19.11,36.43 22.5,34 C 25.89,36.43 32.61,35.03 36,36 C 36,36 37.65,36.54 39,38 C 38.32,38.97 37.35,38.99 36,38.5 C 32.61,37.53 25.89,38.96 22.5,37.5 C 19.11,38.96 12.39,37.53 9,38.5 C 7.65,38.99 6.68,38.97 6,38 C 7.35,36.54 9,36 9,36 z"/>
<path d="M 15,32 C 17.5,34.5 27.5,34.5 30,32 C 30.5,30.5 30,30 30,30 C 30,27.5 27.5,26 27.5,26 C 33,24.5 33.5,14.5 22.5,10.5 C 11.5,14.5 12,24.5 17.5,26 C 17.5,26 15,27.5 15,30 C 15,30 14.5,30.5 15,32 z"/>
<path d="M 25 8 A 2.5 2.5 0 1 1 20,8 A 2.5 2.5 0 1 1 25 8 z"/>
</g>
<path d="M 17.5,26 L 27.5,26 M 15,30 L 30,30 M 22.5,15.5 L 22.5,20.5 M 20,18 L 25,18" style="fill:none; stroke:#000000; stroke-linejoin:miter;"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bal1cx2x7hk7l"
path="res://.godot/imported/WBishop.svg-686706903502a95cd46cd77a78ee9440.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://ChessTextures/WBishop.svg"
dest_files=["res://.godot/imported/WBishop.svg-686706903502a95cd46cd77a78ee9440.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
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

9
ChessTextures/WKing.svg Normal file
View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" width="45" height="45">
<g fill="none" fill-rule="evenodd" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5">
<path stroke-linejoin="miter" d="M22.5 11.63V6M20 8h5"/>
<path fill="#fff" stroke-linecap="butt" stroke-linejoin="miter" d="M22.5 25s4.5-7.5 3-10.5c0 0-1-2.5-3-2.5s-3 2.5-3 2.5c-1.5 3 3 10.5 3 10.5"/>
<path fill="#fff" d="M12.5 37c5.5 3.5 14.5 3.5 20 0v-7s9-4.5 6-10.5c-4-6.5-13.5-3.5-16 4V27v-3.5c-2.5-7.5-12-10.5-16-4-3 6 6 10.5 6 10.5v7"/>
<path d="M12.5 30c5.5-3 14.5-3 20 0m-20 3.5c5.5-3 14.5-3 20 0m-20 3.5c5.5-3 14.5-3 20 0"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 700 B

View file

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bgeifkewhw83q"
path="res://.godot/imported/WKing.svg-5baf29b7cc0647974c7427255174f754.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://ChessTextures/WKing.svg"
dest_files=["res://.godot/imported/WKing.svg-5baf29b7cc0647974c7427255174f754.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
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

19
ChessTextures/WKnight.svg Normal file
View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="45" height="45">
<g style="opacity:1; fill:none; fill-opacity:1; fill-rule:evenodd; stroke:#000000; stroke-width:1.5; stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;" transform="translate(0,0.3)">
<path
d="M 22,10 C 32.5,11 38.5,18 38,39 L 15,39 C 15,30 25,32.5 23,18"
style="fill:#ffffff; stroke:#000000;" />
<path
d="M 24,18 C 24.38,20.91 18.45,25.37 16,27 C 13,29 13.18,31.34 11,31 C 9.958,30.06 12.41,27.96 11,28 C 10,28 11.19,29.23 10,30 C 9,30 5.997,31 6,26 C 6,24 12,14 12,14 C 12,14 13.89,12.1 14,10.5 C 13.27,9.506 13.5,8.5 13.5,7.5 C 14.5,6.5 16.5,10 16.5,10 L 18.5,10 C 18.5,10 19.28,8.008 21,7 C 22,7 22,10 22,10"
style="fill:#ffffff; stroke:#000000;" />
<path
d="M 9.5 25.5 A 0.5 0.5 0 1 1 8.5,25.5 A 0.5 0.5 0 1 1 9.5 25.5 z"
style="fill:#000000; stroke:#000000;" />
<path
d="M 15 15.5 A 0.5 1.5 0 1 1 14,15.5 A 0.5 1.5 0 1 1 15 15.5 z"
transform="matrix(0.866,0.5,-0.5,0.866,9.693,-5.173)"
style="fill:#000000; stroke:#000000;" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dnp45xyp0eesa"
path="res://.godot/imported/WKnight.svg-77361976620fc1216b47056d5a4529b1.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://ChessTextures/WKnight.svg"
dest_files=["res://.godot/imported/WKnight.svg-77361976620fc1216b47056d5a4529b1.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
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

5
ChessTextures/WPawn.svg Normal file
View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="45" height="45">
<path d="m 22.5,9 c -2.21,0 -4,1.79 -4,4 0,0.89 0.29,1.71 0.78,2.38 C 17.33,16.5 16,18.59 16,21 c 0,2.03 0.94,3.84 2.41,5.03 C 15.41,27.09 11,31.58 11,39.5 H 34 C 34,31.58 29.59,27.09 26.59,26.03 28.06,24.84 29,23.03 29,21 29,18.59 27.67,16.5 25.72,15.38 26.21,14.71 26.5,13.89 26.5,13 c 0,-2.21 -1.79,-4 -4,-4 z" style="opacity:1; fill:#ffffff; fill-opacity:1; fill-rule:nonzero; stroke:#000000; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:miter; stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;"/>
</svg>

After

Width:  |  Height:  |  Size: 766 B

View file

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dl5dp47xg34sb"
path="res://.godot/imported/WPawn.svg-b837731bbfbbbf8bc72cb8688f8b3a79.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://ChessTextures/WPawn.svg"
dest_files=["res://.godot/imported/WPawn.svg-b837731bbfbbbf8bc72cb8688f8b3a79.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
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

15
ChessTextures/WQueen.svg Normal file
View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="45" height="45">
<g style="fill:#ffffff;stroke:#000000;stroke-width:1.5;stroke-linejoin:round">
<path d="M 9,26 C 17.5,24.5 30,24.5 36,26 L 38.5,13.5 L 31,25 L 30.7,10.9 L 25.5,24.5 L 22.5,10 L 19.5,24.5 L 14.3,10.9 L 14,25 L 6.5,13.5 L 9,26 z"/>
<path d="M 9,26 C 9,28 10.5,28 11.5,30 C 12.5,31.5 12.5,31 12,33.5 C 10.5,34.5 11,36 11,36 C 9.5,37.5 11,38.5 11,38.5 C 17.5,39.5 27.5,39.5 34,38.5 C 34,38.5 35.5,37.5 34,36 C 34,36 34.5,34.5 33,33.5 C 32.5,31 32.5,31.5 33.5,30 C 34.5,28 36,28 36,26 C 27.5,24.5 17.5,24.5 9,26 z"/>
<path d="M 11.5,30 C 15,29 30,29 33.5,30" style="fill:none"/>
<path d="M 12,33.5 C 18,32.5 27,32.5 33,33.5" style="fill:none"/>
<circle cx="6" cy="12" r="2" />
<circle cx="14" cy="9" r="2" />
<circle cx="22.5" cy="8" r="2" />
<circle cx="31" cy="9" r="2" />
<circle cx="39" cy="12" r="2" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cr1lku07l36wb"
path="res://.godot/imported/WQueen.svg-0bb76d6b190776365484fd4d31df0913.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://ChessTextures/WQueen.svg"
dest_files=["res://.godot/imported/WQueen.svg-0bb76d6b190776365484fd4d31df0913.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
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

25
ChessTextures/WRook.svg Normal file
View file

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="45" height="45">
<g style="opacity:1; fill:#ffffff; fill-opacity:1; fill-rule:evenodd; stroke:#000000; stroke-width:1.5; stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4; stroke-dasharray:none; stroke-opacity:1;" transform="translate(0,0.3)">
<path
d="M 9,39 L 36,39 L 36,36 L 9,36 L 9,39 z "
style="stroke-linecap:butt;" />
<path
d="M 12,36 L 12,32 L 33,32 L 33,36 L 12,36 z "
style="stroke-linecap:butt;" />
<path
d="M 11,14 L 11,9 L 15,9 L 15,11 L 20,11 L 20,9 L 25,9 L 25,11 L 30,11 L 30,9 L 34,9 L 34,14"
style="stroke-linecap:butt;" />
<path
d="M 34,14 L 31,17 L 14,17 L 11,14" />
<path
d="M 31,17 L 31,29.5 L 14,29.5 L 14,17"
style="stroke-linecap:butt; stroke-linejoin:miter;" />
<path
d="M 31,29.5 L 32.5,32 L 12.5,32 L 14,29.5" />
<path
d="M 11,14 L 34,14"
style="fill:none; stroke:#000000; stroke-linejoin:miter;" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://qisaumos7b53"
path="res://.godot/imported/WRook.svg-39b447f94ad3647c8bc4cff26af8747b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://ChessTextures/WRook.svg"
dest_files=["res://.godot/imported/WRook.svg-39b447f94ad3647c8bc4cff26af8747b.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
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

82
board.tscn Normal file
View file

@ -0,0 +1,82 @@
[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="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"]
[node name="Board" type="Control"]
layout_mode = 3
anchors_preset = 0
offset_right = 40.0
offset_bottom = 40.0
script = ExtResource("1_f1l42")
BoardPath = NodePath("Flow")
[node name="Flow" type="FlowContainer" parent="."]
layout_mode = 0
script = ExtResource("1_ckrtr")
Pawn = ExtResource("3_871tv")
Bishop = ExtResource("4_f2vpi")
Rook = ExtResource("5_lwy4i")
Knight = ExtResource("6_ta68t")
Queen = ExtResource("7_7creb")
King = ExtResource("8_vvr6q")
[node name="GameWin" type="Control" parent="."]
anchors_preset = 0
offset_right = 40.0
offset_bottom = 40.0
script = ExtResource("9_ww6wk")
[node name="Promotion" type="Panel" parent="."]
visible = false
layout_mode = 0
offset_left = 531.0
offset_top = 130.0
offset_right = 731.0
offset_bottom = 330.0
[node name="Rook" type="Button" parent="Promotion"]
layout_mode = 0
offset_left = 8.0
offset_top = 10.0
offset_right = 55.0
offset_bottom = 41.0
text = "Rook"
[node name="Bishop" type="Button" parent="Promotion"]
layout_mode = 0
offset_left = 68.0
offset_top = 10.0
offset_right = 115.0
offset_bottom = 41.0
text = "Bishop"
[node name="Knight" type="Button" parent="Promotion"]
layout_mode = 0
offset_left = 9.0
offset_top = 50.0
offset_right = 56.0
offset_bottom = 81.0
text = "Knight"
[node name="Queen" type="Button" parent="Promotion"]
layout_mode = 0
offset_left = 79.0
offset_top = 52.0
offset_right = 140.0
offset_bottom = 83.0
text = "Queen"
[connection signal="GameWin" from="." to="GameWin" method="_on_board_game_win"]
[connection signal="SendLocation" from="Flow" to="." method="_on_flow_send_location"]
[connection signal="pressed" from="Promotion/Rook" to="." method="FinalizePromotion" binds= ["Rook"]]
[connection signal="pressed" from="Promotion/Bishop" to="." method="FinalizePromotion" binds= ["Bishop"]]
[connection signal="pressed" from="Promotion/Knight" to="." method="FinalizePromotion" binds= ["Knight"]]
[connection signal="pressed" from="Promotion/Queen" to="." method="FinalizePromotion" binds= ["Queen"]]

381
game.gd Normal file
View file

@ -0,0 +1,381 @@
extends Control
signal GameWin
# Selected node is the button pressed before the one you just pressed.
var SelectedNode = ""
# If you don't have a good solution, do your promotions with another variable~
var SavedNode = ""
var Turn = 0
# Location on which node was clicked.
# Ints are here to reduce the size of some lines.
var LocationX: String
var LocationY: String
var LocationXInt: int
var LocationYInt: int
# This is the board buttons.
@export_node_path("FlowContainer") var BoardPath
@onready var Flow = get_node(BoardPath)
@onready var pos: Vector2 = Vector2(self.get_child(0).TileXSize / 2, self.get_child(0).TileYSize / 2)
# Areas where the player can move
var Areas: PackedStringArray
# this is seperate the Areas for special circumstances, like castling.
var SpecialArea: PackedStringArray
func _on_flow_send_location(Location: String):
# Don't update ANYTHING if you still need to promote!
if get_node("Promotion").visible == true:
return
# variables for later
var number = 0
var cell = Flow.get_node(Location)
# This is to try and grab the X and Y coordinates from the board
LocationX = ""
LocationY = ""
while Location.substr(number, 1) != "-":
LocationX += Location.substr(number, 1)
number += 1
LocationY = Location.substr(number + 1)
LocationXInt = int(LocationX)
LocationYInt = int(LocationY)
# Now... we need to figure out how to select the pieces. If there is a valid move, do stuff.
# If we re-select, just go to that other piece
if SelectedNode == "" && cell.get_child_count() != 0 && cell.get_child(0).PieceColor == Turn:
SelectedNode = Location
GetMovableAreas()
# Castling
elif SelectedNode != "" && cell.get_child_count() != 0 && cell.get_child(0).PieceColor == Turn && cell.get_child(0).name == "Rook":
for i in Areas:
if i == cell.name:
var king = Flow.get_node(SelectedNode).get_child(0)
var rook = cell.get_child(0)
# Using a seperate array because Areas wouldn't be really consistant...
king.reparent(Flow.get_node(SpecialArea[1]))
rook.reparent(Flow.get_node(SpecialArea[0]))
king.position = pos
rook.position = pos
# We have to get the parent because it will break lmao.
UpdateGame(cell)
# En Passant
elif SelectedNode != "" && cell.get_child_count() != 0 && cell.get_child(0).PieceColor != Turn && cell.get_child(0).name == "Pawn" && SpecialArea.size() != 0 && SpecialArea[0] == cell.name && cell.get_child(0).EnPassant == true:
for i in SpecialArea:
if i == cell.name:
var pawn = Flow.get_node(SelectedNode).get_child(0)
cell.get_child(0).free()
pawn.reparent(Flow.get_node(SpecialArea[1]))
pawn.position = pos
UpdateGame(cell)
# Re-select
elif SelectedNode != "" && cell.get_child_count() != 0 && cell.get_child(0).PieceColor == Turn:
SelectedNode = Location
GetMovableAreas()
# Taking over a piece
elif SelectedNode != "" && cell.get_child_count() != 0 && cell.get_child(0).PieceColor != Turn:
for i in Areas:
if i == cell.name:
var Piece = Flow.get_node(SelectedNode).get_child(0)
# Win conditions
if cell.get_child(0).name == "King":
GameWin.emit()
cell.get_child(0).free()
SavedNode = Location
Piece.reparent(cell)
Piece.position = pos
UpdateGame(cell)
# Moving a piece
elif SelectedNode != "" && cell.get_child_count() == 0:
for i in Areas:
if i == cell.name:
var Piece = Flow.get_node(SelectedNode).get_child(0)
SavedNode = Location
Piece.reparent(cell)
Piece.position = pos
UpdateGame(cell)
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()
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
# Remove and add the abilities once they are either used or not used
if cell.get_child(0).name == "Pawn":
PawnPromotion(cell.get_child(0))
if cell.get_child(0).DoubleStart == true:
cell.get_child(0).EnPassant = true
cell.get_child(0).DoubleStart = false
if cell.get_child(0).name == "King":
cell.get_child(0).Castling = false
if cell.get_child(0).name == "Rook":
cell.get_child(0).Castling = false
# Below is the movement that is used for the pieces
func GetMovableAreas():
# Clearing the arrays
Areas.clear()
SpecialArea.clear()
var Piece = Flow.get_node(SelectedNode).get_child(0)
# For the selected piece that we have, we can get the movement that we need here.
if Piece.name == "Pawn":
GetPawn(Piece)
elif Piece.name == "Bishop":
GetDiagonals()
elif Piece.name == "King":
GetAround(Piece)
elif Piece.name == "Queen":
GetDiagonals()
GetRows()
elif Piece.name == "Rook":
GetRows()
elif Piece.name == "Knight":
GetHorse()
func PawnPromotion(Piece):
# This is for going from the bottom to the top, also known as the white pawns.
if IsNull(LocationX + "-" + str(LocationYInt - 1)) && Piece.PieceColor == 0:
get_node("Promotion").visible = true
elif IsNull(LocationX + "-" + str(LocationYInt + 1)) && Piece.PieceColor == 1:
get_node("Promotion").visible = true
# TODO: Make this less crap
func FinalizePromotion(Selection):
var Piece = Flow.get_node(SavedNode).get_child(0)
var NewPiece
if Selection == "Bishop":
var thing = ResourceLoader.load("res://ChessScenes/bishop.tscn")
NewPiece = thing.instantiate()
if Piece.PieceColor == 0:
NewPiece.Spawned(0)
else:
NewPiece.Spawned(1)
NewPiece.position = pos
Flow.get_node(SavedNode).add_child(NewPiece)
elif Selection == "Queen":
var thing = ResourceLoader.load("res://ChessScenes/queen.tscn")
NewPiece = thing.instantiate()
if Piece.PieceColor == 0:
NewPiece.Spawned(0)
else:
NewPiece.Spawned(1)
NewPiece.position = pos
Flow.get_node(SavedNode).add_child(NewPiece)
elif Selection == "Rook":
var thing = ResourceLoader.load("res://ChessScenes/rook.tscn")
NewPiece = thing.instantiate()
if Piece.PieceColor == 0:
NewPiece.Spawned(0)
else:
NewPiece.Spawned(1)
NewPiece.position = pos
Flow.get_node(SavedNode).add_child(NewPiece)
elif Selection == "Knight":
var thing = ResourceLoader.load("res://ChessScenes/knight.tscn")
NewPiece = thing.instantiate()
if Piece.PieceColor == 0:
NewPiece.Spawned(0)
else:
NewPiece.Spawned(1)
NewPiece.position = pos
Flow.get_node(SavedNode).add_child(NewPiece)
Piece.free()
get_node("Promotion").visible = false
func GetPawn(Piece):
# This is for going from the bottom to the top, also known as the white pawns.
if Piece.PieceColor == 0:
if not IsNull(LocationX + "-" + str(LocationYInt - 1)) && Flow.get_node(LocationX + "-" + str(LocationYInt - 1)).get_child_count() == 0:
Areas.append(LocationX + "-" + str(LocationYInt - 1))
if not IsNull(LocationX + "-" + str(LocationYInt - 2)) && Piece.DoubleStart == true && Flow.get_node(LocationX + "-" + str(LocationYInt - 2)).get_child_count() == 0:
Areas.append(LocationX + "-" + str(LocationYInt - 2))
# Attacking squares
if not IsNull(str(LocationXInt - 1) + "-" + str(LocationYInt - 1)) && Flow.get_node(str(LocationXInt - 1) + "-" + str(LocationYInt - 1)).get_child_count() == 1:
Areas.append(str(LocationXInt - 1) + "-" + str(LocationYInt - 1))
if not IsNull(str(LocationXInt + 1) + "-" + str(LocationYInt - 1)) && Flow.get_node(str(LocationXInt + 1) + "-" + str(LocationYInt - 1)).get_child_count() == 1:
Areas.append(str(LocationXInt + 1) + "-" + str(LocationYInt - 1))
# En passant
if not IsNull(str(LocationXInt - 1) + "-" + LocationY) && not IsNull(str(LocationXInt - 1) + "-" + str(LocationYInt - 1)):
if Flow.get_node(str(LocationXInt - 1) + "-" + LocationY).get_child_count() == 1 && Flow.get_node(str(LocationXInt - 1) + "-" + str(LocationYInt - 1)).get_child_count() != 1:
SpecialArea.append(str(LocationXInt - 1) + "-" + LocationY)
SpecialArea.append(str(LocationXInt - 1) + "-" + str(LocationYInt - 1))
if not IsNull(str(LocationXInt + 1) + "-" + LocationY) && not IsNull(str(LocationXInt + 1) + "-" + str(LocationYInt - 1)):
if Flow.get_node(str(LocationXInt + 1) + "-" + LocationY).get_child_count() == 1 && Flow.get_node(str(LocationXInt + 1) + "-" + str(LocationYInt - 1)).get_child_count() != 1:
SpecialArea.append(str(LocationXInt + 1) + "-" + LocationY)
SpecialArea.append(str(LocationXInt + 1) + "-" + str(LocationYInt - 1))
# Black pawns
else:
if not IsNull(LocationX + "-" + str(LocationYInt + 1)) && Flow.get_node(LocationX + "-" + str(LocationYInt + 1)).get_child_count() == 0:
Areas.append(LocationX + "-" + str(LocationYInt + 1))
if not IsNull(LocationX + "-" + str(LocationYInt + 2)) && Piece.DoubleStart == true && Flow.get_node(LocationX + "-" + str(LocationYInt + 2)).get_child_count() == 0:
Areas.append(LocationX + "-" + str(LocationYInt + 2))
# Attacking squares
if not IsNull(str(LocationXInt - 1) + "-" + str(LocationYInt + 1)) && Flow.get_node(str(LocationXInt - 1) + "-" + str(LocationYInt + 1)).get_child_count() == 1:
Areas.append(str(LocationXInt - 1) + "-" + str(LocationYInt + 1))
if not IsNull(str(LocationXInt + 1) + "-" + str(LocationYInt + 1)) && Flow.get_node(str(LocationXInt + 1) + "-" + str(LocationYInt + 1)).get_child_count() == 1:
Areas.append(str(LocationXInt + 1) + "-" + str(LocationYInt + 1))
# En passant
if not IsNull(str(LocationXInt - 1) + "-" + LocationY) && not IsNull(str(LocationXInt - 1) + "-" + str(LocationYInt + 1)):
if Flow.get_node(str(LocationXInt - 1) + "-" + LocationY).get_child_count() == 1 && Flow.get_node(str(LocationXInt - 1) + "-" + str(LocationYInt + 1)).get_child_count() != 1:
SpecialArea.append(str(LocationXInt - 1) + "-" + LocationY)
SpecialArea.append(str(LocationXInt - 1) + "-" + str(LocationYInt + 1))
if not IsNull(str(LocationXInt + 1) + "-" + LocationY) && not IsNull(str(LocationXInt + 1) + "-" + str(LocationYInt + 1)):
if Flow.get_node(str(LocationXInt + 1) + "-" + LocationY).get_child_count() == 1 && Flow.get_node(str(LocationXInt + 1) + "-" + str(LocationYInt+ 1)).get_child_count() != 1:
SpecialArea.append(str(LocationXInt + 1) + "-" + LocationY)
SpecialArea.append(str(LocationXInt + 1) + "-" + str(LocationYInt + 1))
func GetAround(Piece):
# Single Rows
if not IsNull(LocationX + "-" + str(LocationYInt + 1)):
Areas.append(LocationX + "-" + str(LocationYInt + 1))
if not IsNull(LocationX + "-" + str(LocationYInt - 1)):
Areas.append(LocationX + "-" + str(LocationYInt - 1))
if not IsNull(str(LocationXInt + 1) + "-" + LocationY):
Areas.append(str(LocationXInt + 1) + "-" + LocationY)
if not IsNull(str(LocationXInt - 1) + "-" + LocationY):
Areas.append(str(LocationXInt - 1) + "-" + LocationY)
# Diagonal
if not IsNull(str(LocationXInt + 1) + "-" + str(LocationYInt + 1)):
Areas.append(str(LocationXInt + 1) + "-" + str(LocationYInt + 1))
if not IsNull(str(LocationXInt - 1) + "-" + str(LocationYInt + 1)):
Areas.append(str(LocationXInt - 1) + "-" + str(LocationYInt + 1))
if not IsNull(str(LocationXInt + 1) + "-" + str(LocationYInt - 1)):
Areas.append(str(LocationXInt + 1) + "-" + str(LocationYInt - 1))
if not IsNull(str(LocationXInt - 1) + "-" + str(LocationYInt - 1)):
Areas.append(str(LocationXInt - 1) + "-" + str(LocationYInt - 1))
# Castling, if that is the case
if Piece.Castling == true:
Castle()
func GetRows():
var AddX = 1
# Getting the horizontal rows first.
while not IsNull(str(LocationXInt + AddX) + "-" + LocationY):
Areas.append(str(LocationXInt + AddX) + "-" + LocationY)
if Flow.get_node(str(LocationXInt + AddX) + "-" + LocationY).get_child_count() != 0:
break
AddX += 1
AddX = 1
while not IsNull(str(LocationXInt - AddX) + "-" + LocationY):
Areas.append(str(LocationXInt - AddX) + "-" + LocationY)
if Flow.get_node(str(LocationXInt - AddX) + "-" + LocationY).get_child_count() != 0:
break
AddX += 1
var AddY = 1
# Now we are getting the vertical rows.
while not IsNull(LocationX + "-" + str(LocationYInt + AddY)):
Areas.append(LocationX + "-" + str(LocationYInt + AddY))
if Flow.get_node(LocationX + "-" + str(LocationYInt + AddY)).get_child_count() != 0:
break
AddY += 1
AddY = 1
while not IsNull(LocationX + "-" + str(LocationYInt - AddY)):
Areas.append(LocationX + "-" + str(LocationYInt - AddY))
if Flow.get_node(LocationX + "-" + str(LocationYInt - AddY)).get_child_count() != 0:
break
AddY += 1
func GetDiagonals():
var AddX = 1
var AddY = 1
while not IsNull(str(LocationXInt + AddX) + "-" + str(LocationYInt + AddY)):
Areas.append(str(LocationXInt + AddX) + "-" + str(LocationYInt + AddY))
if Flow.get_node(str(LocationXInt + AddX) + "-" + str(LocationYInt + AddY)).get_child_count() != 0:
break
AddX += 1
AddY += 1
AddX = 1
AddY = 1
while not IsNull(str(LocationXInt - AddX) + "-" + str(LocationYInt + AddY)):
Areas.append(str(LocationXInt - AddX) + "-" + str(LocationYInt + AddY))
if Flow.get_node(str(LocationXInt - AddX) + "-" + str(LocationYInt + AddY)).get_child_count() != 0:
break
AddX += 1
AddY += 1
AddX = 1
AddY = 1
while not IsNull(str(LocationXInt + AddX) + "-" + str(LocationYInt - AddY)):
Areas.append(str(LocationXInt + AddX) + "-" + str(LocationYInt - AddY))
if Flow.get_node(str(LocationXInt + AddX) + "-" + str(LocationYInt - AddY)).get_child_count() != 0:
break
AddX += 1
AddY += 1
AddX = 1
AddY = 1
while not IsNull(str(LocationXInt - AddX) + "-" + str(LocationYInt - AddY)):
Areas.append(str(LocationXInt - AddX) + "-" + str(LocationYInt - AddY))
if Flow.get_node(str(LocationXInt - AddX) + "-" + str(LocationYInt - AddY)).get_child_count() != 0:
break
AddX += 1
AddY += 1
func GetHorse():
var TheX = 2
var TheY = 1
var number = 0
while number != 8:
# So this one is interesting. This is most likely the cleanest code here.
# Get the numbers, replace the numbers, and loop until it stops.
if not IsNull(str(LocationXInt + TheX) + "-" + str(LocationYInt + TheY)):
Areas.append(str(LocationXInt + TheX) + "-" + str(LocationYInt + TheY))
number += 1
match number:
1:
TheX = 1
TheY = 2
2:
TheX = -2
TheY = 1
3:
TheX = -1
TheY = 2
4:
TheX = 2
TheY = -1
5:
TheX = 1
TheY = -2
6:
TheX = -2
TheY = -1
7:
TheX = -1
TheY = -2
func Castle():
# This is the castling section right here, used if a person wants to castle.
var CounterX = 1
# These are very similar to gathering a row, except we want free tiles and a rook
# Counting up
while not IsNull(str(LocationXInt + CounterX) + "-" + LocationY) && Flow.get_node(str(LocationXInt + CounterX) + "-" + LocationY).get_child_count() == 0:
CounterX += 1
if not IsNull(str(LocationXInt + CounterX) + "-" + LocationY) && Flow.get_node(str(LocationXInt + CounterX) + "-" + LocationY).get_child(0).name == "Rook":
if Flow.get_node(str(LocationXInt + CounterX) + "-" + LocationY).get_child(0).Castling == true:
Areas.append(str(LocationXInt + CounterX) + "-" + LocationY)
SpecialArea.append(str(LocationXInt + 1) + "-" + LocationY)
SpecialArea.append(str(LocationXInt + 2) + "-" + LocationY)
# Counting down
CounterX = -1
while not IsNull(str(LocationXInt + CounterX) + "-" + LocationY) && Flow.get_node(str(LocationXInt + CounterX) + "-" + LocationY).get_child_count() == 0:
CounterX -= 1
if not IsNull(str(LocationXInt + CounterX) + "-" + LocationY) && Flow.get_node(str(LocationXInt + CounterX) + "-" + LocationY).get_child(0).name == "Rook":
if Flow.get_node(str(LocationXInt + CounterX) + "-" + LocationY).get_child(0).Castling == true:
Areas.append(str(LocationXInt + CounterX) + "-" + LocationY)
SpecialArea.append(str(LocationXInt - 1) + "-" + LocationY)
SpecialArea.append(str(LocationXInt - 2) + "-" + LocationY)
# One function that shortens everything. Its also a pretty good way to see if we went off the board or not.
func IsNull(Location):
if Flow.get_node_or_null(Location) == null:
return true
else:
return false

4
game_win.gd Normal file
View file

@ -0,0 +1,4 @@
extends Control
func _on_board_game_win() -> void:
print("Damn, you win!")

87
generator.gd Normal file
View file

@ -0,0 +1,87 @@
extends FlowContainer
@export var BoardXSize = 8
@export var BoardYSize = 8
@export var TileXSize: float = 50
@export var TileYSize: float = 50
@export var PlayRegularGame: bool = true
signal SendLocation(Location: String)
@export var Pawn: PackedScene
@export var Bishop: PackedScene
@export var Rook: PackedScene
@export var Knight: PackedScene
@export var Queen: PackedScene
@export var King: PackedScene
func _ready():
# stop negative numbers from happening
if BoardXSize < 0 || BoardYSize < 0:
return
var NumberX: int = 0
var NumberY: int = 0
# Set up the board
while NumberY != BoardYSize:
self.size.y += TileYSize + 5
self.size.x += TileXSize + 5
while NumberX != BoardXSize:
var temp = Button.new()
temp.set_custom_minimum_size(Vector2(TileXSize, TileYSize))
temp.connect("pressed", func():
SendLocation.emit(temp.name))
temp.set_name(str(NumberX) + "-" + str(NumberY))
add_child(temp)
NumberX += 1
NumberY += 1
NumberX = 0
if PlayRegularGame == true:
RegularGame()
# 1 = black
# 0 = white
func RegularGame():
get_node("0-0").add_child(Summon(Rook, 1))
get_node("1-0").add_child(Summon(Knight, 1))
get_node("2-0").add_child(Summon(Bishop, 1))
get_node("3-0").add_child(Summon(Queen, 1))
get_node("4-0").add_child(Summon(King, 1))
get_node("5-0").add_child(Summon(Bishop, 1))
get_node("6-0").add_child(Summon(Knight, 1))
get_node("7-0").add_child(Summon(Rook, 1))
get_node("0-1").add_child(Summon(Pawn, 1))
get_node("1-1").add_child(Summon(Pawn, 1))
get_node("2-1").add_child(Summon(Pawn, 1))
get_node("3-1").add_child(Summon(Pawn, 1))
get_node("4-1").add_child(Summon(Pawn, 1))
get_node("5-1").add_child(Summon(Pawn, 1))
get_node("6-1").add_child(Summon(Pawn, 1))
get_node("7-1").add_child(Summon(Pawn, 1))
get_node("0-6").add_child(Summon(Pawn, 0))
get_node("1-6").add_child(Summon(Pawn, 0))
get_node("2-6").add_child(Summon(Pawn, 0))
get_node("3-6").add_child(Summon(Pawn, 0))
get_node("4-6").add_child(Summon(Pawn, 0))
get_node("5-6").add_child(Summon(Pawn, 0))
get_node("6-6").add_child(Summon(Pawn, 0))
get_node("7-6").add_child(Summon(Pawn, 0))
get_node("0-7").add_child(Summon(Rook, 0))
get_node("1-7").add_child(Summon(Knight, 0))
get_node("2-7").add_child(Summon(Bishop, 0))
get_node("3-7").add_child(Summon(Queen, 0))
get_node("4-7").add_child(Summon(King, 0))
get_node("5-7").add_child(Summon(Bishop, 0))
get_node("6-7").add_child(Summon(Knight, 0))
get_node("7-7").add_child(Summon(Rook, 0))
func Summon(Scene: PackedScene, color: int):
var Piece = Scene.instantiate()
Piece.Spawned(color)
# This is the point, ignore the warning
Piece.position = Vector2(TileXSize / 2, TileYSize / 2)
return Piece

25
project.godot Normal file
View file

@ -0,0 +1,25 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=5
[application]
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/icon="res://Chess.png"
[editor_plugins]
enabled=PackedStringArray()
[filesystem]
import/blender/enabled=false