diff --git a/Scenes/bullet.tscn b/Scenes/bullet.tscn new file mode 100644 index 00000000..c20a9152 --- /dev/null +++ b/Scenes/bullet.tscn @@ -0,0 +1,16 @@ +[gd_scene load_steps=3 format=3 uid="uid://b1qnfiuokpvsr"] + +[ext_resource type="Texture2D" uid="uid://cybpmpb0d8yva" path="res://Sprites/Projectile.png" id="1_2eu87"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_jxptd"] +radius = 2.23607 + +[node name="Bullet" type="Node2D"] + +[node name="RigidBody2D" type="RigidBody2D" parent="."] + +[node name="Sprite2D" type="Sprite2D" parent="RigidBody2D"] +texture = ExtResource("1_2eu87") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D"] +shape = SubResource("CircleShape2D_jxptd") diff --git a/Scenes/fragola.tscn b/Scenes/fragola.tscn new file mode 100644 index 00000000..c1ecc80a --- /dev/null +++ b/Scenes/fragola.tscn @@ -0,0 +1,79 @@ +[gd_scene load_steps=10 format=3 uid="uid://rp4jhx0tuh24"] + +[ext_resource type="Texture2D" uid="uid://cy5usvdeabi0t" path="res://Sprites/fragola.png" id="1_5wy11"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_j6kkb"] +atlas = ExtResource("1_5wy11") +region = Rect2(0, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ahsj2"] +atlas = ExtResource("1_5wy11") +region = Rect2(16, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_b3l4k"] +atlas = ExtResource("1_5wy11") +region = Rect2(32, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ignt2"] +atlas = ExtResource("1_5wy11") +region = Rect2(48, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_aqfk6"] +atlas = ExtResource("1_5wy11") +region = Rect2(64, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_rbhio"] +atlas = ExtResource("1_5wy11") +region = Rect2(80, 0, 16, 16) + +[sub_resource type="SpriteFrames" id="SpriteFrames_7uyln"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_j6kkb") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ahsj2") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_b3l4k") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ignt2") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_aqfk6") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_rbhio") +}], +"loop": true, +"name": &"explode", +"speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_j6kkb") +}], +"loop": true, +"name": &"idle", +"speed": 5.0 +}] + +[sub_resource type="CircleShape2D" id="CircleShape2D_bbnjh"] +radius = 7.0 + +[node name="Fragola" type="Node2D"] + +[node name="Fragola" type="RigidBody2D" parent="."] +collision_layer = 4 +collision_mask = 7 +mass = 0.03 +gravity_scale = 0.0 + +[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="Fragola"] +sprite_frames = SubResource("SpriteFrames_7uyln") +animation = &"idle" + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Fragola"] +shape = SubResource("CircleShape2D_bbnjh") diff --git a/Scenes/test.tscn b/Scenes/test.tscn index 426100dc..65a185ac 100644 --- a/Scenes/test.tscn +++ b/Scenes/test.tscn @@ -1,31 +1,74 @@ -[gd_scene load_steps=21 format=3 uid="uid://bv451a8wgty4u"] +[gd_scene load_steps=25 format=3 uid="uid://bv451a8wgty4u"] [ext_resource type="Script" path="res://Scripts/PlayerMovement.cs" id="1_fwei5"] -[ext_resource type="Texture2D" uid="uid://dowueaq2rixdk" path="res://Sprites/Cirno2.0.png" id="2_uhufh"] -[ext_resource type="Texture2D" uid="uid://c6yjjxhp2hj1d" path="res://Sprites/Cirno2.1.png" id="3_bixcs"] -[ext_resource type="Texture2D" uid="uid://dhxr6y4318myo" path="res://Sprites/Cirno2.2.png" id="4_mwt28"] -[ext_resource type="Texture2D" uid="uid://7cvh3mmocc5v" path="res://Sprites/Cirno2.3.png" id="5_04174"] -[ext_resource type="Texture2D" uid="uid://cgv3cvw3jpjbm" path="res://Sprites/Cirno2.8.png" id="6_oy6vt"] -[ext_resource type="Texture2D" uid="uid://sficqk0a81pa" path="res://Sprites/Cirno2.9.png" id="7_5fs74"] -[ext_resource type="Texture2D" uid="uid://bc8ayjrtm7gj0" path="res://Sprites/Cirno2.10.png" id="8_klw6k"] -[ext_resource type="Texture2D" uid="uid://1ssa5a3of3ev" path="res://Sprites/Cirno2.11.png" id="9_72uad"] -[ext_resource type="Texture2D" uid="uid://dllmicsylbi43" path="res://Sprites/Cirno2.4.png" id="10_3pt04"] -[ext_resource type="Texture2D" uid="uid://gv36lxe1yg1u" path="res://Sprites/Cirno2.5.png" id="11_a2fi2"] -[ext_resource type="Texture2D" uid="uid://br4sks70xogjv" path="res://Sprites/Cirno2.6.png" id="12_ej2t4"] -[ext_resource type="Texture2D" uid="uid://crty86347gh4f" path="res://Sprites/Cirno2.7.png" id="13_kvwm8"] -[ext_resource type="Texture2D" uid="uid://ibn5d1fal13g" path="res://Sprites/Cirno2.12.png" id="14_e1x71"] -[ext_resource type="Texture2D" uid="uid://bulqenrcafawr" path="res://Sprites/Cirno2.13.png" id="15_dx3o0"] -[ext_resource type="Texture2D" uid="uid://cu8yj5f0r0hq0" path="res://Sprites/Cirno2.14.png" id="16_gcac2"] -[ext_resource type="Texture2D" uid="uid://dgnbwg4my1jfe" path="res://Sprites/Cirno2.15.png" id="17_et2yp"] +[ext_resource type="Texture2D" uid="uid://la06powu57hu" path="res://Sprites/Cirno_Big.png" id="2_7wt5q"] +[ext_resource type="PackedScene" uid="uid://b1qnfiuokpvsr" path="res://Scenes/bullet.tscn" id="4_nwkfm"] +[ext_resource type="PackedScene" uid="uid://rp4jhx0tuh24" path="res://Scenes/fragola.tscn" id="4_s7wq6"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_46wey"] +atlas = ExtResource("2_7wt5q") +region = Rect2(0, 0, 8, 16) [sub_resource type="RectangleShape2D" id="RectangleShape2D_2gpmr"] size = Vector2(6, 8) +[sub_resource type="AtlasTexture" id="AtlasTexture_pdst4"] +atlas = ExtResource("2_7wt5q") +region = Rect2(0, 0, 8, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_s7dqe"] +atlas = ExtResource("2_7wt5q") +region = Rect2(0, 0, 8, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_irmjj"] +atlas = ExtResource("2_7wt5q") +region = Rect2(8, 0, 8, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_chuua"] +atlas = ExtResource("2_7wt5q") +region = Rect2(16, 0, 8, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_nhxfa"] +atlas = ExtResource("2_7wt5q") +region = Rect2(0, 32, 8, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_tnyrl"] +atlas = ExtResource("2_7wt5q") +region = Rect2(8, 32, 8, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_awe4i"] +atlas = ExtResource("2_7wt5q") +region = Rect2(16, 32, 8, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_n0dww"] +atlas = ExtResource("2_7wt5q") +region = Rect2(0, 48, 8, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_pq4ul"] +atlas = ExtResource("2_7wt5q") +region = Rect2(8, 48, 8, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_w3vni"] +atlas = ExtResource("2_7wt5q") +region = Rect2(16, 48, 8, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_kg1c7"] +atlas = ExtResource("2_7wt5q") +region = Rect2(0, 16, 8, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_qe0jv"] +atlas = ExtResource("2_7wt5q") +region = Rect2(8, 16, 8, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_6pgul"] +atlas = ExtResource("2_7wt5q") +region = Rect2(16, 16, 8, 16) + [sub_resource type="SpriteFrames" id="SpriteFrames_ur7bf"] animations = [{ "frames": [{ "duration": 1.0, -"texture": ExtResource("2_uhufh") +"texture": SubResource("AtlasTexture_pdst4") }], "loop": true, "name": &"idle", @@ -33,16 +76,13 @@ animations = [{ }, { "frames": [{ "duration": 1.0, -"texture": ExtResource("2_uhufh") +"texture": SubResource("AtlasTexture_s7dqe") }, { "duration": 1.0, -"texture": ExtResource("3_bixcs") +"texture": SubResource("AtlasTexture_irmjj") }, { "duration": 1.0, -"texture": ExtResource("4_mwt28") -}, { -"duration": 1.0, -"texture": ExtResource("5_04174") +"texture": SubResource("AtlasTexture_chuua") }], "loop": true, "name": &"walk_down", @@ -50,16 +90,13 @@ animations = [{ }, { "frames": [{ "duration": 1.0, -"texture": ExtResource("6_oy6vt") +"texture": SubResource("AtlasTexture_nhxfa") }, { "duration": 1.0, -"texture": ExtResource("7_5fs74") +"texture": SubResource("AtlasTexture_tnyrl") }, { "duration": 1.0, -"texture": ExtResource("8_klw6k") -}, { -"duration": 1.0, -"texture": ExtResource("9_72uad") +"texture": SubResource("AtlasTexture_awe4i") }], "loop": true, "name": &"walk_left", @@ -67,16 +104,13 @@ animations = [{ }, { "frames": [{ "duration": 1.0, -"texture": ExtResource("10_3pt04") +"texture": SubResource("AtlasTexture_n0dww") }, { "duration": 1.0, -"texture": ExtResource("11_a2fi2") +"texture": SubResource("AtlasTexture_pq4ul") }, { "duration": 1.0, -"texture": ExtResource("12_ej2t4") -}, { -"duration": 1.0, -"texture": ExtResource("13_kvwm8") +"texture": SubResource("AtlasTexture_w3vni") }], "loop": true, "name": &"walk_right", @@ -84,16 +118,13 @@ animations = [{ }, { "frames": [{ "duration": 1.0, -"texture": ExtResource("14_e1x71") +"texture": SubResource("AtlasTexture_kg1c7") }, { "duration": 1.0, -"texture": ExtResource("15_dx3o0") +"texture": SubResource("AtlasTexture_qe0jv") }, { "duration": 1.0, -"texture": ExtResource("16_gcac2") -}, { -"duration": 1.0, -"texture": ExtResource("17_et2yp") +"texture": SubResource("AtlasTexture_6pgul") }], "loop": true, "name": &"walk_up", @@ -103,25 +134,44 @@ animations = [{ [sub_resource type="RectangleShape2D" id="RectangleShape2D_qui05"] size = Vector2(20, 153) +[sub_resource type="RectangleShape2D" id="RectangleShape2D_v0c0p"] +size = Vector2(141, 13) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_5ir3o"] +size = Vector2(9, 70) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_e3rcm"] +size = Vector2(134, 7) + [node name="Node2D" type="Node2D"] position = Vector2(38, 39) -[node name="CharacterBody2D" type="CharacterBody2D" parent="."] +[node name="Polygon2D" type="Polygon2D" parent="."] +position = Vector2(41, -4.31633) +scale = Vector2(1, 1.23469) +color = Color(0.278431, 0.8, 0.396078, 1) +polygon = PackedVector2Array(95, 57, 46, 58, -83, 61, -91, -37, 88, -37, 114, -1) + +[node name="Player" type="CharacterBody2D" parent="."] +collision_layer = 2 +collision_mask = 3 script = ExtResource("1_fwei5") -Speed = 1600 +Speed = 1800 -[node name="Sprite2D" type="Sprite2D" parent="CharacterBody2D"] +[node name="Sprite2D" type="Sprite2D" parent="Player"] visible = false -texture = ExtResource("2_uhufh") +scale = Vector2(2.5, 1.75) +texture = SubResource("AtlasTexture_46wey") +hframes = 3 +vframes = 4 +frame = 1 -[node name="CollisionShape2D" type="CollisionShape2D" parent="CharacterBody2D"] +[node name="CollisionShape2D" type="CollisionShape2D" parent="Player"] shape = SubResource("RectangleShape2D_2gpmr") -[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="CharacterBody2D"] +[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="Player"] sprite_frames = SubResource("SpriteFrames_ur7bf") -animation = &"walk_down" -frame = 1 -frame_progress = 0.964336 +animation = &"walk_left" [node name="StaticBody2D" type="StaticBody2D" parent="."] @@ -130,4 +180,26 @@ position = Vector2(113, 54.5) shape = SubResource("RectangleShape2D_qui05") [node name="Polygon2D" type="Polygon2D" parent="StaticBody2D"] +position = Vector2(0, -14.5556) +scale = Vector2(1, 1.11111) polygon = PackedVector2Array(103, -21, 123, -22, 122, 131, 105, 131) + +[node name="Muro 2" type="StaticBody2D" parent="."] + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Muro 2"] +position = Vector2(32.5, 37.5) +shape = SubResource("RectangleShape2D_v0c0p") + +[node name="CollisionShape2D2" type="CollisionShape2D" parent="Muro 2"] +position = Vector2(-34.5, -4) +shape = SubResource("RectangleShape2D_5ir3o") + +[node name="CollisionShape2D3" type="CollisionShape2D" parent="Muro 2"] +position = Vector2(37, -35.5) +shape = SubResource("RectangleShape2D_e3rcm") + +[node name="Bullet" parent="." instance=ExtResource("4_nwkfm")] +position = Vector2(36, 2) + +[node name="Fragola" parent="." instance=ExtResource("4_s7wq6")] +position = Vector2(62, 10) diff --git a/Scripts/PlayerMovement.cs b/Scripts/PlayerMovement.cs index a10a623d..17b6b14a 100644 --- a/Scripts/PlayerMovement.cs +++ b/Scripts/PlayerMovement.cs @@ -5,9 +5,9 @@ public partial class PlayerMovement : CharacterBody2D { [Export] public int Speed { get; set; } = 400; - + private AnimatedSprite2D _animatedSprite; - + public override void _Ready() { _animatedSprite = GetNode("AnimatedSprite2D"); @@ -25,6 +25,43 @@ public partial class PlayerMovement : CharacterBody2D } }*/ + public override void _Process(double delta) + { + SetAnimation(); + } + + private void SetAnimation() + { + + if (Velocity.X == 0 && Velocity.Y == 0) + { + _animatedSprite.SpeedScale = 0; + } + else + { + _animatedSprite.SpeedScale = 1; + } + + if (Velocity.X > 0) + { + _animatedSprite.Play("walk_right"); + } + else if (Velocity.X < 0) + { + _animatedSprite.Play("walk_left"); + } + else if (Velocity.Y > 0) + { + _animatedSprite.Play("walk_down"); + } + else if (Velocity.Y < 0) + { + _animatedSprite.Play("walk_up"); + } + + + } + public Vector2 GetInput() { return Input.GetVector("left", "right", "up", "down"); diff --git a/Sprites/Cirno_Big.aseprite b/Sprites/Cirno_Big.aseprite new file mode 100644 index 00000000..7673a6d5 --- /dev/null +++ b/Sprites/Cirno_Big.aseprite @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b1bdd810912794da10bc1448345723103842ceac5e954926169d57a5640bd376 +size 2628 diff --git a/Sprites/Cirno_Big.png b/Sprites/Cirno_Big.png new file mode 100644 index 00000000..36fbee98 --- /dev/null +++ b/Sprites/Cirno_Big.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:816985baf9def749bb8cbb84fade3d5188f0b390073e11670537f66426f8500b +size 678 diff --git a/Sprites/Cirno_Big.png.import b/Sprites/Cirno_Big.png.import new file mode 100644 index 00000000..51601462 --- /dev/null +++ b/Sprites/Cirno_Big.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://la06powu57hu" +path="res://.godot/imported/Cirno_Big.png-c4086aee70a18ce52ae48497505ecda3.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Sprites/Cirno_Big.png" +dest_files=["res://.godot/imported/Cirno_Big.png-c4086aee70a18ce52ae48497505ecda3.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/Sprites/Projectile.aseprite b/Sprites/Projectile.aseprite new file mode 100644 index 00000000..bd100cc0 --- /dev/null +++ b/Sprites/Projectile.aseprite @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5af060bdbb35fbe495ea0459643c9bcd464623feeb51e026ee22b5c51b93e823 +size 630 diff --git a/Sprites/Projectile.png b/Sprites/Projectile.png new file mode 100644 index 00000000..fe6a64a1 --- /dev/null +++ b/Sprites/Projectile.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aacfe08ac95ffcbddf5e43582933ea66b9af7bbe8bf42d35bf9ea1cf7e57ac1a +size 102 diff --git a/Sprites/Projectile.png.import b/Sprites/Projectile.png.import new file mode 100644 index 00000000..e54dc7cc --- /dev/null +++ b/Sprites/Projectile.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cybpmpb0d8yva" +path="res://.godot/imported/Projectile.png-a3a119d8fd8345a39899211a3cae4b28.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Sprites/Projectile.png" +dest_files=["res://.godot/imported/Projectile.png-a3a119d8fd8345a39899211a3cae4b28.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/Sprites/fragola.aseprite b/Sprites/fragola.aseprite new file mode 100644 index 00000000..6421c245 --- /dev/null +++ b/Sprites/fragola.aseprite @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cacbd39aa0a15a2301e4771709d7a98d17aa58533d4f0b56b00a316eff55284b +size 1558 diff --git a/Sprites/fragola.png b/Sprites/fragola.png new file mode 100644 index 00000000..a046b833 --- /dev/null +++ b/Sprites/fragola.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c67cec82ef76b61cbbcde58e8c809aee7084427b6b67630586d24c259fc39ac0 +size 753 diff --git a/Sprites/fragola.png.import b/Sprites/fragola.png.import new file mode 100644 index 00000000..0f43a04a --- /dev/null +++ b/Sprites/fragola.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cy5usvdeabi0t" +path="res://.godot/imported/fragola.png-248b2ad8f6634b5ebe74825a1a857e13.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Sprites/fragola.png" +dest_files=["res://.godot/imported/fragola.png-248b2ad8f6634b5ebe74825a1a857e13.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/project.godot b/project.godot index 03fbd292..794f2942 100644 --- a/project.godot +++ b/project.godot @@ -59,6 +59,12 @@ click={ ] } +[layer_names] + +2d_physics/layer_1="world" +2d_physics/layer_2="player" +2d_physics/layer_3="items" + [rendering] textures/canvas_textures/default_texture_filter=0