diff --git a/Sprite.cs b/Abdullah.cs similarity index 65% rename from Sprite.cs rename to Abdullah.cs index cd7cb79..f93c46a 100644 --- a/Sprite.cs +++ b/Abdullah.cs @@ -2,14 +2,17 @@ using Godot; namespace Tutorial1; -public partial class Sprite : Sprite2D { +public partial class Abdullah : Sprite2D { private const int AMOUNT = 5; - public override void _Ready() { } + private Sprite2D child; + + public override void _Ready() => child = GetNode("Child"); public override void _Process(double delta) { if (Input.IsKeyPressed(Key.W)) Position += new Vector2(0, -AMOUNT); if (Input.IsKeyPressed(Key.S)) Position += new Vector2(0, AMOUNT); if (Input.IsKeyPressed(Key.A)) Position += new Vector2(-AMOUNT, 0); if (Input.IsKeyPressed(Key.D)) Position += new Vector2(AMOUNT, 0); + if (Input.IsKeyPressed(Key.Space)) child.GlobalPosition = Vector2.Zero; } } \ No newline at end of file diff --git a/Abdullah.tscn b/Abdullah.tscn new file mode 100644 index 0000000..9fd390e --- /dev/null +++ b/Abdullah.tscn @@ -0,0 +1,15 @@ +[gd_scene load_steps=4 format=3 uid="uid://bdbubb2tx11e8"] + +[ext_resource type="Texture2D" uid="uid://d0ft51rdr6k02" path="res://Icons/Godot.svg" id="1_h0rd0"] +[ext_resource type="Script" path="res://Abdullah.cs" id="2_4iohr"] +[ext_resource type="Texture2D" uid="uid://b202jnjsma8y4" path="res://Icons/Tomato.png" id="3_ffpuj"] + +[node name="Abdullah" type="Sprite2D"] +position = Vector2(460, 266) +texture = ExtResource("1_h0rd0") +script = ExtResource("2_4iohr") + +[node name="Child" type="Sprite2D" parent="."] +position = Vector2(100, 100) +scale = Vector2(0.5, 0.5) +texture = ExtResource("3_ffpuj") diff --git a/icon.svg b/Icons/Godot.svg similarity index 100% rename from icon.svg rename to Icons/Godot.svg diff --git a/icon.svg.import b/Icons/Godot.svg.import similarity index 73% rename from icon.svg.import rename to Icons/Godot.svg.import index 346de7e..e854892 100644 --- a/icon.svg.import +++ b/Icons/Godot.svg.import @@ -2,16 +2,16 @@ importer="texture" type="CompressedTexture2D" -uid="uid://b4phmd113v1ch" -path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" +uid="uid://d0ft51rdr6k02" +path="res://.godot/imported/Godot.svg-3c82d9e893d17e4b0ad5e3f6168c240f.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://icon.svg" -dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"] +source_file="res://Icons/Godot.svg" +dest_files=["res://.godot/imported/Godot.svg-3c82d9e893d17e4b0ad5e3f6168c240f.ctex"] [params] diff --git a/Icons/Tomato.png b/Icons/Tomato.png new file mode 100755 index 0000000..46df362 Binary files /dev/null and b/Icons/Tomato.png differ diff --git a/Icons/Tomato.png.import b/Icons/Tomato.png.import new file mode 100644 index 0000000..2355b43 --- /dev/null +++ b/Icons/Tomato.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b202jnjsma8y4" +path="res://.godot/imported/Tomato.png-366c3d75d8887c64ffc28776aabb3494.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Icons/Tomato.png" +dest_files=["res://.godot/imported/Tomato.png-366c3d75d8887c64ffc28776aabb3494.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 diff --git a/Sprite.tscn b/Sprite.tscn deleted file mode 100644 index 1ef963b..0000000 --- a/Sprite.tscn +++ /dev/null @@ -1,9 +0,0 @@ -[gd_scene load_steps=3 format=3 uid="uid://d00d571xqjd81"] - -[ext_resource type="Texture2D" uid="uid://b4phmd113v1ch" path="res://icon.svg" id="1_5v71i"] -[ext_resource type="Script" path="res://Sprite.cs" id="2_u7j2b"] - -[node name="Sprite2D" type="Sprite2D"] -position = Vector2(575, 340) -texture = ExtResource("1_5v71i") -script = ExtResource("2_u7j2b") diff --git a/project.godot b/project.godot index c6e083c..1879080 100644 --- a/project.godot +++ b/project.godot @@ -11,7 +11,7 @@ config_version=5 [application] config/name="Tutorial1" -run/main_scene="res://Sprite.tscn" +run/main_scene="res://Abdullah.tscn" config/features=PackedStringArray("4.1", "C#", "Forward Plus") config/icon="res://icon.svg"