Tutorial2

master
Sascha 2023-09-01 10:52:19 +07:00
parent ccaa363c2f
commit 1ec0a9d907
8 changed files with 59 additions and 16 deletions

@ -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<Sprite2D>("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;
}
}

@ -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")

Before

Width:  |  Height:  |  Size: 950 B

After

Width:  |  Height:  |  Size: 950 B

@ -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]

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

@ -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

@ -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")

@ -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"