online multiplayer chess game (note server currently down)
make the promotion look gud
bendn 2022-05-02
parent f461ce6 · commit 4d80d60
-rw-r--r--Grid.gd7
-rw-r--r--World.tscn9
-rw-r--r--pieces/Pawn.gd3
3 files changed, 15 insertions, 4 deletions
diff --git a/Grid.gd b/Grid.gd
index 5cc125f..9b6e7a8 100644
--- a/Grid.gd
+++ b/Grid.gd
@@ -212,12 +212,11 @@ func init_board(): # create the board
func add_pieces(): # add the pieces
add_pawns()
- add_rooks()
- add_knights()
- add_bishops()
+ # add_rooks()
+ # add_knights()
+ # add_bishops()
add_queens()
add_kings()
- print_matrix_pretty()
func add_pawns():
diff --git a/World.tscn b/World.tscn
index 2f512ea..9b820e2 100644
--- a/World.tscn
+++ b/World.tscn
@@ -14,4 +14,13 @@ script = ExtResource( 1 )
[node name="Foreground" type="CanvasLayer" parent="Grid"]
+[node name="Darken" type="ColorRect" parent="Grid"]
+visible = false
+anchor_right = 1.0
+anchor_bottom = 1.0
+rect_min_size = Vector2( 800, 800 )
+mouse_filter = 2
+mouse_default_cursor_shape = 7
+color = Color( 0, 0, 0, 0.784314 )
+
[node name="UI" parent="." instance=ExtResource( 2 )]
diff --git a/pieces/Pawn.gd b/pieces/Pawn.gd
index 1f94961..42ed456 100644
--- a/pieces/Pawn.gd
+++ b/pieces/Pawn.gd
@@ -9,6 +9,7 @@ var enpassant := []
onready var whiteint := 1 if white else -1
onready var sprites := []
+onready var darken = get_node("../../Darken")
func _ready():
@@ -111,12 +112,14 @@ func promote(position, type):
take(at_pos(position))
else:
moveto(position)
+ darken.show()
for i in range(len(promotables)):
sprites[i].sprite.texture = load("%s%s%s" % [Globals.grid.ASSETS_PATH, team.to_lower(), promotables[i]])
sprites[i].show()
func handle_sprite_input_event(node):
+ darken.hide()
var script = piece(promotables[sprites.find(node)][0])
Globals.grid.make_piece(real_position, script, white)
Globals.grid.turn_over()