commit f7c6ded9c8cb34a3ce903553c78318f559a96414 Author: Daniel Poag Date: Fri Dec 29 00:00:55 2023 -0600 mostly working, need netcode, en passant, and castling diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..8ad74f7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Normalize EOL for all files that Git considers text files. +* text=auto eol=lf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4709183 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# Godot 4+ specific ignores +.godot/ diff --git a/Bishop.gd b/Bishop.gd new file mode 100644 index 0000000..212ff4d --- /dev/null +++ b/Bishop.gd @@ -0,0 +1,25 @@ +extends "res://Piece.gd" + + +func setup(): + kind = KIND.BISHOP + var sprite2d = get_node("Sprite2D") + if team == TEAM.WHITE: + sprite2d.region_rect = Rect2(95, 4, 35, 36) + elif team == TEAM.BLACK: + sprite2d.region_rect = Rect2(95, 49, 35, 36) + +func check_move(destination: Vector2i) -> bool: + var board_state = get_board_state() + if board_state.has(destination): + if board_state[destination].team == team: + return false + + if !path_empty(destination): + return false + + var dx = abs(destination.x - grid_pos.x) + var dy = abs(destination.y - grid_pos.y) + + return dx == dy and dx > 0 + diff --git a/Bishop.tscn b/Bishop.tscn new file mode 100644 index 0000000..b48a77a --- /dev/null +++ b/Bishop.tscn @@ -0,0 +1,12 @@ +[gd_scene load_steps=4 format=3 uid="uid://cmj0gtmfsdblb"] + +[ext_resource type="PackedScene" uid="uid://dyw0vra6it4f6" path="res://Piece.tscn" id="1_7mdde"] +[ext_resource type="Script" path="res://Bishop.gd" id="2_bajhn"] +[ext_resource type="Texture2D" uid="uid://cgwutjks35c7e" path="res://Chess_Pieces_Sprite.svg" id="3_m3vdx"] + +[node name="Area2D" instance=ExtResource("1_7mdde")] +script = ExtResource("2_bajhn") + +[node name="Sprite2D" parent="." index="0"] +texture = ExtResource("3_m3vdx") +region_rect = Rect2(95, 4, 35, 36) diff --git a/Board.gd b/Board.gd new file mode 100644 index 0000000..889ae31 --- /dev/null +++ b/Board.gd @@ -0,0 +1,129 @@ +extends TileMap + +@export var board_state: Dictionary = Dictionary() + +@onready var king = preload("res://King.tscn") +@onready var knight = preload("res://Knight.tscn") +@onready var rook = preload("res://Rook.tscn") +@onready var queen = preload("res://Queen.tscn") +@onready var bishop = preload("res://Bishop.tscn") +@onready var pawn = preload("res://Pawn.tscn") + +# Called when the node enters the scene tree for the first time. +func _ready(): + setup_board() + + var children = get_children() + for child in children: + if child.has_signal("moved"): + child.moved.connect(_on_piece_moved) + board_state[child.grid_pos] = child + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + pass + +func _on_piece_moved(piece, old_pos, new_pos): + if board_state.has(new_pos): + var destroyed = board_state[new_pos] + if destroyed.is_king(): + get_tree().paused = true + board_state.erase(new_pos) + destroyed.queue_free() + board_state.erase(old_pos) + + var new_piece = piece + if piece.is_pawn(): + if piece.is_white() and new_pos.y == 0: + new_piece = queen.instantiate() + new_piece.grid_size = tile_set.tile_size + new_piece.make_white() + new_piece.grid_pos = new_pos + add_child(new_piece) + piece.queue_free() + elif piece.is_black() and new_pos.y == 7: + new_piece = queen.instantiate() + new_piece.grid_size = tile_set.tile_size + new_piece.make_black() + new_piece.grid_pos = new_pos + add_child(new_piece) + piece.queue_free() + board_state[new_pos] = new_piece + +func setup_board(): + var king_instance = king.instantiate() + king_instance.grid_size = tile_set.tile_size + king_instance.make_white() + king_instance.grid_pos = Vector2i(4,7) + add_child(king_instance) + + var bking_instance = king.instantiate() + bking_instance.grid_size = tile_set.tile_size + bking_instance.make_black() + bking_instance.grid_pos = Vector2i(4,0) + add_child(bking_instance) + + var queen_instance = queen.instantiate() + queen_instance.grid_size = tile_set.tile_size + queen_instance.make_white() + queen_instance.grid_pos = Vector2i(3,7) + add_child(queen_instance) + + var bqueen_instance = queen.instantiate() + bqueen_instance.grid_size = tile_set.tile_size + bqueen_instance.make_black() + bqueen_instance.grid_pos = Vector2i(3,0) + add_child(bqueen_instance) + + for x in [1, 6]: + var knight_instance = knight.instantiate() + knight_instance.grid_size = tile_set.tile_size + knight_instance.make_white() + knight_instance.grid_pos = Vector2i(x,7) + add_child(knight_instance) + + var bknight_instance = knight.instantiate() + bknight_instance.grid_size = tile_set.tile_size + bknight_instance.make_black() + bknight_instance.grid_pos = Vector2i(x,0) + add_child(bknight_instance) + + for x in [0, 7]: + var rook_instance = rook.instantiate() + rook_instance.grid_size = tile_set.tile_size + rook_instance.make_white() + rook_instance.grid_pos = Vector2i(x,7) + add_child(rook_instance) + + var brook_instance = rook.instantiate() + brook_instance.grid_size = tile_set.tile_size + brook_instance.make_black() + brook_instance.grid_pos = Vector2i(x,0) + add_child(brook_instance) + + for x in [2, 5]: + var bishop_instance = bishop.instantiate() + bishop_instance.grid_size = tile_set.tile_size + bishop_instance.make_white() + bishop_instance.grid_pos = Vector2i(x,7) + add_child(bishop_instance) + + var bbishop_instance = bishop.instantiate() + bbishop_instance.grid_size = tile_set.tile_size + bbishop_instance.make_black() + bbishop_instance.grid_pos = Vector2i(x,0) + add_child(bbishop_instance) + + for x in range(0, 8): + var pawn_instance = pawn.instantiate() + pawn_instance.grid_size = tile_set.tile_size + pawn_instance.make_white() + pawn_instance.grid_pos = Vector2i(x,6) + add_child(pawn_instance) + + var bpawn_instance = pawn.instantiate() + bpawn_instance.grid_size = tile_set.tile_size + bpawn_instance.make_black() + bpawn_instance.grid_pos = Vector2i(x,1) + add_child(bpawn_instance) + diff --git a/Board.tscn b/Board.tscn new file mode 100644 index 0000000..5b5efba --- /dev/null +++ b/Board.tscn @@ -0,0 +1,21 @@ +[gd_scene load_steps=5 format=3 uid="uid://biklwr66hudpd"] + +[ext_resource type="Texture2D" uid="uid://dirue6kbvxdat" path="res://Tiles.svg" id="1_heb2f"] +[ext_resource type="Script" path="res://Board.gd" id="2_kd5g1"] + +[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_8ren2"] +texture = ExtResource("1_heb2f") +texture_region_size = Vector2i(38, 38) +use_texture_padding = false +0:0/0 = 0 +1:0/0 = 0 + +[sub_resource type="TileSet" id="TileSet_qi5mr"] +tile_size = Vector2i(38, 38) +sources/0 = SubResource("TileSetAtlasSource_8ren2") + +[node name="TileMap" type="TileMap"] +tile_set = SubResource("TileSet_qi5mr") +format = 2 +layer_0/tile_data = PackedInt32Array(1, 0, 0, 65536, 0, 0, 131073, 0, 0, 65538, 0, 0, 3, 0, 0, 196608, 0, 0, 5, 0, 0, 65540, 0, 0, 131075, 0, 0, 196610, 0, 0, 262145, 0, 0, 327680, 0, 0, 7, 0, 0, 65542, 0, 0, 131077, 0, 0, 196612, 0, 0, 262147, 0, 0, 327682, 0, 0, 393217, 0, 0, 458752, 0, 0, 458754, 0, 0, 393219, 0, 0, 327684, 0, 0, 262149, 0, 0, 196614, 0, 0, 131079, 0, 0, 262151, 0, 0, 327686, 0, 0, 393221, 0, 0, 458756, 0, 0, 458758, 0, 0, 393223, 0, 0, 458753, 65536, 0, 393216, 65536, 0, 262144, 65536, 0, 131072, 65536, 0, 0, 65536, 0, 2, 65536, 0, 65537, 65536, 0, 131074, 65536, 0, 196609, 65536, 0, 327681, 65536, 0, 262146, 65536, 0, 393218, 65536, 0, 458755, 65536, 0, 458757, 65536, 0, 458759, 65536, 0, 393222, 65536, 0, 327687, 65536, 0, 327685, 65536, 0, 393220, 65536, 0, 262150, 65536, 0, 196615, 65536, 0, 196613, 65536, 0, 262148, 65536, 0, 327683, 65536, 0, 196611, 65536, 0, 131076, 65536, 0, 131078, 65536, 0, 65543, 65536, 0, 6, 65536, 0, 65541, 65536, 0, 4, 65536, 0, 65539, 65536, 0) +script = ExtResource("2_kd5g1") diff --git a/Chess_Pieces_Sprite.svg b/Chess_Pieces_Sprite.svg new file mode 100644 index 0000000..20649d1 --- /dev/null +++ b/Chess_Pieces_Sprite.svg @@ -0,0 +1,254 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Chess_Pieces_Sprite.svg.import b/Chess_Pieces_Sprite.svg.import new file mode 100644 index 0000000..992a0dc --- /dev/null +++ b/Chess_Pieces_Sprite.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cgwutjks35c7e" +path="res://.godot/imported/Chess_Pieces_Sprite.svg-1ff6d13f4fe62b001920763db3338bd7.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Chess_Pieces_Sprite.svg" +dest_files=["res://.godot/imported/Chess_Pieces_Sprite.svg-1ff6d13f4fe62b001920763db3338bd7.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 diff --git a/King.gd b/King.gd new file mode 100644 index 0000000..ca55bc8 --- /dev/null +++ b/King.gd @@ -0,0 +1,18 @@ +extends "res://Piece.gd" + +func setup(): + kind = KIND.KING + var sprite2d = get_node("Sprite2D") + if team == TEAM.WHITE: + sprite2d.region_rect = Rect2(5, 5, 35, 36) + elif team == TEAM.BLACK: + sprite2d.region_rect = Rect2(5, 50, 35, 36) + +func check_move(destination: Vector2i) -> bool: + var board_state = get_board_state() + if board_state.has(destination): + if board_state[destination].team == team: + return false + # TODO castling + + return abs(destination.x - grid_pos.x) + abs(destination.y - grid_pos.y) == 1 diff --git a/King.tscn b/King.tscn new file mode 100644 index 0000000..5f04f16 --- /dev/null +++ b/King.tscn @@ -0,0 +1,11 @@ +[gd_scene load_steps=4 format=3 uid="uid://cph4rivrfduvx"] + +[ext_resource type="PackedScene" uid="uid://dyw0vra6it4f6" path="res://Piece.tscn" id="1_dkrxf"] +[ext_resource type="Script" path="res://King.gd" id="2_1gvdw"] +[ext_resource type="Texture2D" uid="uid://cgwutjks35c7e" path="res://Chess_Pieces_Sprite.svg" id="2_x3kym"] + +[node name="Area2D" instance=ExtResource("1_dkrxf")] +script = ExtResource("2_1gvdw") + +[node name="Sprite2D" parent="." index="0"] +texture = ExtResource("2_x3kym") diff --git a/Knight.gd b/Knight.gd new file mode 100644 index 0000000..4ddccd7 --- /dev/null +++ b/Knight.gd @@ -0,0 +1,19 @@ +extends "res://Piece.gd" + +func setup(): + kind = KIND.KNIGHT + var sprite2d = get_node("Sprite2D") + if team == TEAM.WHITE: + sprite2d.region_rect = Rect2(140, 6, 34, 34) + elif team == TEAM.BLACK: + sprite2d.region_rect = Rect2(140, 51, 34, 34) + +func check_move(destination: Vector2i) -> bool: + var board_state = get_board_state() + if board_state.has(destination): + if board_state[destination].team == team: + return false + + var dx = abs(destination.x - grid_pos.x) + var dy = abs(destination.y - grid_pos.y) + return min(dx, dy) == 1 and max(dx, dy) == 2 diff --git a/Knight.tscn b/Knight.tscn new file mode 100644 index 0000000..e1cb637 --- /dev/null +++ b/Knight.tscn @@ -0,0 +1,12 @@ +[gd_scene load_steps=4 format=3 uid="uid://twc6lel7yco"] + +[ext_resource type="PackedScene" uid="uid://dyw0vra6it4f6" path="res://Piece.tscn" id="1_um2nk"] +[ext_resource type="Script" path="res://Knight.gd" id="2_as8oi"] +[ext_resource type="Texture2D" uid="uid://cgwutjks35c7e" path="res://Chess_Pieces_Sprite.svg" id="3_qgq37"] + +[node name="Area2D" instance=ExtResource("1_um2nk")] +script = ExtResource("2_as8oi") + +[node name="Sprite2D" parent="." index="0"] +texture = ExtResource("3_qgq37") +region_rect = Rect2(140, 6, 34, 34) diff --git a/Pawn.gd b/Pawn.gd new file mode 100644 index 0000000..b667014 --- /dev/null +++ b/Pawn.gd @@ -0,0 +1,38 @@ +extends "res://Piece.gd" + +#TODO en passant + +func setup(): + kind = KIND.PAWN + var sprite2d = get_node("Sprite2D") + if team == TEAM.WHITE: + sprite2d.region_rect = Rect2(234, 8, 26, 34) + elif team == TEAM.BLACK: + sprite2d.region_rect = Rect2(234, 53, 26, 33) + +func check_move(destination: Vector2i) -> bool: + var enemy_exists = false + var board_state = get_board_state() + if board_state.has(destination): + if board_state[destination].team == team: + return false + else: + enemy_exists = true + + var dx = abs(destination.x - grid_pos.x) + var dy = abs(destination.y - grid_pos.y) + + var forward = dx == 0 and dy == 1 and not enemy_exists + var diag = dx == 1 and dy == 1 and enemy_exists + var correct_direction = false + if team == TEAM.WHITE: + correct_direction = destination.y - grid_pos.y < 0 + elif team == TEAM.BLACK: + correct_direction = destination.y - grid_pos.y > 0 + + if not enemy_exists and correct_direction and dy == 2: + var white_row = team == TEAM.WHITE and grid_pos.y == 6 + var black_row = team == TEAM.BLACK and grid_pos.y == 1 + return path_empty(destination) and (white_row or black_row) + + return correct_direction and (forward or diag) diff --git a/Pawn.tscn b/Pawn.tscn new file mode 100644 index 0000000..ccc5c94 --- /dev/null +++ b/Pawn.tscn @@ -0,0 +1,12 @@ +[gd_scene load_steps=4 format=3 uid="uid://cpf00usfgjyve"] + +[ext_resource type="PackedScene" uid="uid://dyw0vra6it4f6" path="res://Piece.tscn" id="1_ye55b"] +[ext_resource type="Script" path="res://Pawn.gd" id="2_eq4j4"] +[ext_resource type="Texture2D" uid="uid://cgwutjks35c7e" path="res://Chess_Pieces_Sprite.svg" id="3_trr1t"] + +[node name="Area2D" instance=ExtResource("1_ye55b")] +script = ExtResource("2_eq4j4") + +[node name="Sprite2D" parent="." index="0"] +texture = ExtResource("3_trr1t") +region_rect = Rect2(234, 8, 26, 33) diff --git a/Piece.gd b/Piece.gd new file mode 100644 index 0000000..070010e --- /dev/null +++ b/Piece.gd @@ -0,0 +1,140 @@ +extends Area2D + +enum TEAM {WHITE, BLACK, NEUTRAL} +enum KIND {KING, QUEEN, ROOK, BISHOP, KNIGHT, PAWN} + +@export var dragging: bool = false +@export var grid_size: Vector2i = Vector2i(1, 1) +@export var grid_pos: Vector2i = Vector2i(0, 0) +@export var kind: KIND = KIND.PAWN +@export var team: TEAM = TEAM.NEUTRAL + +signal moved(piece: Area2D, old_pos: Vector2i, new_pos: Vector2i) + +# Called when the node enters the scene tree for the first time. +func _ready(): + position = grid_to_pos(grid_pos) + setup() + +func setup(): + pass + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + pass + +func _on_input_event(viewport, event, shape_idx): + if event.is_pressed(): + dragging = true + position = viewport.get_mouse_position(); + +func _unhandled_input(event): + if dragging and event is InputEventMouseButton and not event.pressed: + dragging = false + + var grid_x = floor(position.x / grid_size.x) + var grid_y = floor(position.y / grid_size.y) + + if check_move(Vector2i(grid_x, grid_y)): + moved.emit(self, grid_pos, Vector2i(grid_x, grid_y)) + grid_pos = Vector2i(grid_x, grid_y) + + position = grid_to_pos(grid_pos) + + if self.dragging and event is InputEventMouseMotion: + position += event.relative + +func make_black(): + team = TEAM.BLACK + +func make_white(): + team = TEAM.WHITE + +func make_neutral(): + team = TEAM.NEUTRAL + +func is_black() -> bool: + return team == TEAM.BLACK + +func is_white() -> bool: + return team == TEAM.WHITE + +func is_pawn() -> bool: + return kind == KIND.PAWN + +func is_king() -> bool: + return kind == KIND.KING + +func grid_to_pos(grid_p: Vector2i) -> Vector2: + var new_x = grid_p.x * grid_size.x + grid_size.x / 2 + var new_y = grid_p.y * grid_size.y + grid_size.y / 2 + return Vector2(new_x, new_y) + +func get_board_state() -> Dictionary: + return get_parent().board_state + +func path_empty(destination: Vector2i) -> bool: + var board_state = get_board_state() + + var dx = destination.x - grid_pos.x + var dy = destination.y - grid_pos.y + + if dx == 0: + if dy < 0: + for y in range(destination.y + 1, grid_pos.y): + if board_state.has(Vector2i(grid_pos.x, y)): + return false + elif dy > 0: + for y in range(grid_pos.y + 1, destination.y): + if board_state.has(Vector2i(grid_pos.x, y)): + return false + else: + # no movement + return false + elif dy == 0: + if dx < 0: + for x in range(destination.x + 1, grid_pos.x): + if board_state.has(Vector2i(x, grid_pos.y)): + return false + elif dx > 0: + for x in range(grid_pos.x + 1, destination.x): + if board_state.has(Vector2i(x, grid_pos.y)): + return false + else: + # impossible + return false + elif abs(dx) == abs(dy): + if dx < 0: + if dy < 0: + for d in range(1, abs(dx)): + if board_state.has(Vector2i(grid_pos.x - d, grid_pos.y - d)): + return false + elif dy > 0: + for d in range(1, abs(dx)): + if board_state.has(Vector2i(grid_pos.x - d, grid_pos.y + d)): + return false + else: + # impossible + return false + elif dx > 0: + if dy < 0: + for d in range(1, abs(dx)): + if board_state.has(Vector2i(grid_pos.x + d, grid_pos.y - d)): + return false + elif dy > 0: + for d in range(1, abs(dx)): + if board_state.has(Vector2i(grid_pos.x + d, grid_pos.y + d)): + return false + else: + # impossible + return false + else: + # impossible + return false + else: + # not a legal move + return false + return true + +func check_move(destination: Vector2i) -> bool: + return true diff --git a/Piece.tscn b/Piece.tscn new file mode 100644 index 0000000..b7613c3 --- /dev/null +++ b/Piece.tscn @@ -0,0 +1,21 @@ +[gd_scene load_steps=3 format=3 uid="uid://dyw0vra6it4f6"] + +[ext_resource type="Script" path="res://Piece.gd" id="1_f1vk3"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_v20n7"] +size = Vector2(34, 34) + +[node name="Area2D" type="Area2D"] +script = ExtResource("1_f1vk3") +metadata/_edit_group_ = true + +[node name="Sprite2D" type="Sprite2D" parent="."] +texture_repeat = 1 +region_enabled = true +region_rect = Rect2(5, 5, 35, 36) +metadata/dragging = false + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource("RectangleShape2D_v20n7") + +[connection signal="input_event" from="." to="." method="_on_input_event"] diff --git a/Queen.gd b/Queen.gd new file mode 100644 index 0000000..90d24cd --- /dev/null +++ b/Queen.gd @@ -0,0 +1,25 @@ +extends "res://Piece.gd" + + +func setup(): + kind = KIND.QUEEN + var sprite2d = get_node("Sprite2D") + if team == TEAM.WHITE: + sprite2d.region_rect = Rect2(48, 4, 39, 36) + elif team == TEAM.BLACK: + sprite2d.region_rect = Rect2(48, 50, 39, 37) + +func check_move(destination: Vector2i) -> bool: + var board_state = get_board_state() + if board_state.has(destination): + if board_state[destination].team == team: + return false + + if !path_empty(destination): + return false + + var dx = abs(destination.x - grid_pos.x) + var dy = abs(destination.y - grid_pos.y) + var straight = min(dx, dy) == 0 and max(dx, dy) > 0 + var diagonal = dx == dy and dx > 0 + return straight or diagonal diff --git a/Queen.tscn b/Queen.tscn new file mode 100644 index 0000000..c5545c3 --- /dev/null +++ b/Queen.tscn @@ -0,0 +1,12 @@ +[gd_scene load_steps=4 format=3 uid="uid://dgrj5mn0ccidx"] + +[ext_resource type="PackedScene" uid="uid://dyw0vra6it4f6" path="res://Piece.tscn" id="1_hf7p0"] +[ext_resource type="Script" path="res://Queen.gd" id="2_k32bp"] +[ext_resource type="Texture2D" uid="uid://cgwutjks35c7e" path="res://Chess_Pieces_Sprite.svg" id="3_2kcbn"] + +[node name="Area2D" instance=ExtResource("1_hf7p0")] +script = ExtResource("2_k32bp") + +[node name="Sprite2D" parent="." index="0"] +texture = ExtResource("3_2kcbn") +region_rect = Rect2(48, 4, 39, 36) diff --git a/Rook.gd b/Rook.gd new file mode 100644 index 0000000..df85d05 --- /dev/null +++ b/Rook.gd @@ -0,0 +1,24 @@ +extends "res://Piece.gd" + +# todo castling + +func setup(): + kind = KIND.ROOK + var sprite2d = get_node("Sprite2D") + if team == TEAM.WHITE: + sprite2d.region_rect = Rect2(188, 8, 29, 32) + elif team == TEAM.BLACK: + sprite2d.region_rect = Rect2(188, 53, 29, 32) + +func check_move(destination: Vector2i) -> bool: + var board_state = get_board_state() + if board_state.has(destination): + if board_state[destination].team == team: + return false + + if !path_empty(destination): + return false + + var dx = abs(destination.x - grid_pos.x) + var dy = abs(destination.y - grid_pos.y) + return min(dx, dy) == 0 and max(dx, dy) > 0 diff --git a/Rook.tscn b/Rook.tscn new file mode 100644 index 0000000..38e9558 --- /dev/null +++ b/Rook.tscn @@ -0,0 +1,12 @@ +[gd_scene load_steps=4 format=3 uid="uid://bovak7x6gtvcm"] + +[ext_resource type="PackedScene" uid="uid://dyw0vra6it4f6" path="res://Piece.tscn" id="1_ppb41"] +[ext_resource type="Script" path="res://Rook.gd" id="2_op1wo"] +[ext_resource type="Texture2D" uid="uid://cgwutjks35c7e" path="res://Chess_Pieces_Sprite.svg" id="3_dm10o"] + +[node name="Area2D" instance=ExtResource("1_ppb41")] +script = ExtResource("2_op1wo") + +[node name="Sprite2D" parent="." index="0"] +texture = ExtResource("3_dm10o") +region_rect = Rect2(188, 8, 29, 32) diff --git a/Tiles.svg b/Tiles.svg new file mode 100644 index 0000000..8c496c5 --- /dev/null +++ b/Tiles.svg @@ -0,0 +1,51 @@ + + + + + + + + + + + diff --git a/Tiles.svg.import b/Tiles.svg.import new file mode 100644 index 0000000..8f4f726 --- /dev/null +++ b/Tiles.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dirue6kbvxdat" +path="res://.godot/imported/Tiles.svg-51ddde98b14ff2c3eaebe057a37f7697.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Tiles.svg" +dest_files=["res://.godot/imported/Tiles.svg-51ddde98b14ff2c3eaebe057a37f7697.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 diff --git a/icon.svg b/icon.svg new file mode 100644 index 0000000..b370ceb --- /dev/null +++ b/icon.svg @@ -0,0 +1 @@ + diff --git a/icon.svg.import b/icon.svg.import new file mode 100644 index 0000000..e08176b --- /dev/null +++ b/icon.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cyjglc47bn6gy" +path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.svg" +dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.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 diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..83f05ba --- /dev/null +++ b/project.godot @@ -0,0 +1,22 @@ +; 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="CrazyChess" +run/main_scene="res://Board.tscn" +config/features=PackedStringArray("4.1", "Forward Plus") +config/icon="res://icon.svg" + +[display] + +window/size/viewport_width=304 +window/size/viewport_height=304 +window/stretch/mode="canvas_items"