From 252bd52e5676154b3ac7e983862c9bbff77cb2d2 Mon Sep 17 00:00:00 2001 From: Dragos Stefan Cirstian Date: Fri, 12 Jul 2024 12:16:17 +0300 Subject: [PATCH] Upload files to "/" --- White_Pawn.tscn | 18 ++++++++++++++++++ White_pawn.gd | 15 +++++++++++++++ tile_area.tscn | 17 +++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 White_Pawn.tscn create mode 100644 White_pawn.gd create mode 100644 tile_area.tscn diff --git a/White_Pawn.tscn b/White_Pawn.tscn new file mode 100644 index 0000000..1eba3ca --- /dev/null +++ b/White_Pawn.tscn @@ -0,0 +1,18 @@ +[gd_scene load_steps=4 format=3 uid="uid://bdrva148huqjm"] + +[ext_resource type="Script" path="res://White_pawn.gd" id="1_cao44"] +[ext_resource type="Texture2D" uid="uid://i3yvfhq53pk8" path="res://Asset/Pion_alb.jpeg" id="2_5gkww"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_0433c"] + +[node name="WhitePawn" type="Area2D"] +script = ExtResource("1_cao44") +metadata/_edit_group_ = true + +[node name="Sprite2D" type="Sprite2D" parent="."] +texture = ExtResource("2_5gkww") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +position = Vector2(15, 0) +scale = Vector2(1.75, 5.4) +shape = SubResource("RectangleShape2D_0433c") diff --git a/White_pawn.gd b/White_pawn.gd new file mode 100644 index 0000000..0a294b7 --- /dev/null +++ b/White_pawn.gd @@ -0,0 +1,15 @@ +extends Area2D + +# Proprietăți pion +var type = "pawn" +var color = "white" + +func _ready(): + # Folosim Callable pentru a conecta semnalul + connect("input_event", Callable(self, "_on_pion_input_event")) + +func _on_pion_input_event(viewport, event, shape_idx): + if event is InputEventMouseButton and event.pressed: + if event.button_index == MOUSE_BUTTON_LEFT: + print("Pionul alb a fost click-uit.") + get_parent()._on_piece_input_event(viewport, event, shape_idx, self) diff --git a/tile_area.tscn b/tile_area.tscn new file mode 100644 index 0000000..c4aeaf4 --- /dev/null +++ b/tile_area.tscn @@ -0,0 +1,17 @@ +[gd_scene load_steps=3 format=3 uid="uid://f68oedbkr2yv"] + +[ext_resource type="Script" path="res://tile_area.gd" id="1_rfkfj"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_vas3a"] +size = Vector2(9.2, 20) + +[node name="tile_area" type="Area2D"] +script = ExtResource("1_rfkfj") +metadata/_edit_group_ = true + +[node name="Sprite2D" type="Sprite2D" parent="."] + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +position = Vector2(-27, 0) +scale = Vector2(5, 5) +shape = SubResource("RectangleShape2D_vas3a")