From 83e6f059b56ca88296f7adf61127b8833c4c754d Mon Sep 17 00:00:00 2001 From: RealMelwei Date: Fri, 19 Sep 2025 11:26:39 +0200 Subject: [PATCH 1/3] Leech gravity --- buildings/room_temple.tscn | 2 +- buildings/room_wide_item_above.tscn | 2 +- enemies/leech/leech.gd | 8 ++------ enemies/leech/leech.tscn | 4 ++-- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/buildings/room_temple.tscn b/buildings/room_temple.tscn index 4bafc7f..c0cf08b 100644 --- a/buildings/room_temple.tscn +++ b/buildings/room_temple.tscn @@ -69,7 +69,7 @@ scale = Vector2(2.688, 3) position = Vector2(300, -200) [node name="Leech" parent="EnemyList" instance=ExtResource("10_ibnxs")] -position = Vector2(84, -320) +position = Vector2(240, -340) [node name="DebugSprite" type="Sprite2D" parent="."] visible = false diff --git a/buildings/room_wide_item_above.tscn b/buildings/room_wide_item_above.tscn index 16df163..5a28a4d 100644 --- a/buildings/room_wide_item_above.tscn +++ b/buildings/room_wide_item_above.tscn @@ -66,7 +66,7 @@ position = Vector2(465, -301) position = Vector2(301, -49) [node name="Leech" parent="EnemyList" instance=ExtResource("10_7e5ul")] -position = Vector2(176, -320) +position = Vector2(176, -340) [node name="DebugSprite" type="Sprite2D" parent="."] visible = false diff --git a/enemies/leech/leech.gd b/enemies/leech/leech.gd index 98e2fa6..f5271c1 100644 --- a/enemies/leech/leech.gd +++ b/enemies/leech/leech.gd @@ -13,8 +13,6 @@ var iframes = 0.2 var iframe_time = 0 var dead = false -var check_grounded_delay = 8 - func _ready() -> void: for segment in segments: segment.segment_damaged.connect(hurt) @@ -56,10 +54,8 @@ func _physics_process(delta: float) -> void: get_tree().get_root().print_tree_pretty() segments[i].position = segment_pos_data.position segments[i].rotation = segment_pos_data.rotation - if check_grounded_delay > 0: - check_grounded_delay -= delta - elif not $RayCast2D2.has_overlapping_bodies(): - queue_free() + if not $RayCast2D2.has_overlapping_bodies(): + position += 200 * delta * $EarthAligner.global_from_local(Vector2.DOWN) func calculate_segment_location_and_rotation (i) -> Dictionary: var aerial_end_location = Vector2.from_angle(-angle) * broadth diff --git a/enemies/leech/leech.tscn b/enemies/leech/leech.tscn index 08428d7..bcbb164 100644 --- a/enemies/leech/leech.tscn +++ b/enemies/leech/leech.tscn @@ -6,7 +6,7 @@ [ext_resource type="AudioStream" uid="uid://co07360hqn6fk" path="res://sounds/686321__cjspellsfish__punch-land-soft.wav" id="4_b1m5t"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_cq6dk"] -size = Vector2(2, 24) +size = Vector2(2, 12) [node name="Leech" type="Node2D"] scale = Vector2(1, 1.2) @@ -50,7 +50,7 @@ collision_layer = 0 collision_mask = 8 [node name="CollisionShape2D" type="CollisionShape2D" parent="RayCast2D2"] -position = Vector2(0, 14.8) +position = Vector2(0, 8.8) shape = SubResource("RectangleShape2D_cq6dk") [node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."] From a8f92305ecb683f919dee4e6d39196e771409f6b Mon Sep 17 00:00:00 2001 From: RealMelwei Date: Fri, 19 Sep 2025 12:08:35 +0200 Subject: [PATCH 2/3] Attack animation --- player/player.gd | 15 ++++++++++----- player/player.tscn | 38 +++++++++++++++++++++++++++++++++----- player/sword.png | Bin 0 -> 2111 bytes player/sword.png.import | 40 ++++++++++++++++++++++++++++++++++++++++ player/sword.tscn | 15 ++++++++------- 5 files changed, 91 insertions(+), 17 deletions(-) create mode 100644 player/sword.png create mode 100644 player/sword.png.import diff --git a/player/player.gd b/player/player.gd index 11ae5ba..988a2c8 100644 --- a/player/player.gd +++ b/player/player.gd @@ -87,6 +87,7 @@ func manage_attack(delta : float): if handle_input: if(Input.is_action_just_pressed("attack") and atk_timer <= 0): attack.emit() + $AnimatedSprite2D.play("attack") atk_timer = atk_cooldown func manage_active(_delta : float): @@ -110,12 +111,17 @@ func manage_animation() -> void: if(walk_dir != 0): facing = walk_dir anim_sprite.scale.x = - abs(anim_sprite.scale.x) * facing - if(is_on_floor()): + if(is_on_floor() and not $AnimatedSprite2D.is_playing()): anim_sprite.play("walk") else: - anim_sprite.stop() # Later: Jump Animation? - else : - anim_sprite.stop() + if anim_sprite.animation == "walk": + anim_sprite.stop() + else: + if anim_sprite.animation == "walk": + anim_sprite.stop() + + if not $AnimatedSprite2D.is_playing(): + $AnimatedSprite2D.play("idle") func manage_velocity(delta: float) -> void: up_direction = (position - earth_center).normalized(); @@ -155,7 +161,6 @@ func hurt(dmg: int, dir: Vector2 = Vector2.ZERO): current_hp -= dmg if(current_hp <= 0): die() - inv_time = hit_invulnerability reset_to_velocity = Vector2(-sign(earth_aligner.local_from_global(dir).x)*knockback_strength, -damage_knockup) return true diff --git a/player/player.tscn b/player/player.tscn index 98c4b4f..aeefb1f 100644 --- a/player/player.tscn +++ b/player/player.tscn @@ -1,12 +1,16 @@ -[gd_scene load_steps=15 format=3 uid="uid://cmaovvr15b3qk"] +[gd_scene load_steps=19 format=3 uid="uid://cmaovvr15b3qk"] [ext_resource type="Script" uid="uid://ddidj1uau28ck" path="res://player/player.gd" id="1_4flbx"] [ext_resource type="Texture2D" uid="uid://c4xg25s8loxp0" path="res://player/Player_Walk/Walk 1.png" id="2_hg6s5"] [ext_resource type="Texture2D" uid="uid://chxob4jg7qhqu" path="res://player/Player_Walk/Walk 2.png" id="3_8t03j"] +[ext_resource type="Texture2D" uid="uid://7asmyuhicfoj" path="res://player/attack_animation/Attack Animation 0.png" id="3_32hag"] [ext_resource type="PackedScene" uid="uid://chs0u61f45nau" path="res://utils/earth_aligner.tscn" id="3_i3pqv"] [ext_resource type="Texture2D" uid="uid://vwbnqmbol6hh" path="res://player/Player_Walk/Walk 3.png" id="4_2ieo8"] +[ext_resource type="Texture2D" uid="uid://c4klsmctmol5b" path="res://player/attack_animation/Attack Animation 1.png" id="4_tqiix"] [ext_resource type="PackedScene" uid="uid://d3e3kuyeh6mr1" path="res://player/sword.tscn" id="4_yw30f"] +[ext_resource type="Texture2D" uid="uid://c8xmypqf63l8f" path="res://player/attack_animation/Attack Animation 2.png" id="5_e7oew"] [ext_resource type="Texture2D" uid="uid://dawbam413fob" path="res://player/Player_Walk/Walk 4.png" id="5_ebec5"] +[ext_resource type="Texture2D" uid="uid://em1kmgnaikc1" path="res://player/attack_animation/Attack Animation 3.png" id="6_c35mf"] [ext_resource type="Texture2D" uid="uid://y32k1koww7oy" path="res://player/Player_Walk/Walk 5.png" id="6_yllr7"] [ext_resource type="Texture2D" uid="uid://bo7h3yc40kon3" path="res://player/Player_Walk/Walk 6.png" id="7_kb6p2"] [ext_resource type="PackedScene" uid="uid://beotdg4etmevc" path="res://player/double_jump/double_jump_animation.tscn" id="10_8t03j"] @@ -19,6 +23,31 @@ animations = [{ "frames": [{ "duration": 1.0, +"texture": ExtResource("3_32hag") +}, { +"duration": 1.0, +"texture": ExtResource("4_tqiix") +}, { +"duration": 1.0, +"texture": ExtResource("5_e7oew") +}, { +"duration": 1.0, +"texture": ExtResource("6_c35mf") +}], +"loop": false, +"name": &"attack", +"speed": 10.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": ExtResource("2_hg6s5") +}], +"loop": true, +"name": &"idle", +"speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, "texture": ExtResource("2_hg6s5") }, { "duration": 1.0, @@ -36,7 +65,7 @@ animations = [{ "duration": 1.0, "texture": ExtResource("7_kb6p2") }], -"loop": true, +"loop": false, "name": &"walk", "speed": 10.0 }] @@ -56,13 +85,12 @@ shape = SubResource("CapsuleShape2D_onrkg") [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] scale = Vector2(0.37, 0.37) sprite_frames = SubResource("SpriteFrames_dw050") -animation = &"walk" -frame_progress = 0.433977 +animation = &"idle" [node name="EarthAligner" parent="." instance=ExtResource("3_i3pqv")] [node name="Sword" parent="." instance=ExtResource("4_yw30f")] -position = Vector2(0, -2) +scale = Vector2(1, 1) [node name="ActiveItemCooldown" type="Timer" parent="."] one_shot = true diff --git a/player/sword.png b/player/sword.png new file mode 100644 index 0000000000000000000000000000000000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rL$Ex)+%J_TyjzjQW25-fHFfY#Su%?n3IX|{N z3gAuDr77oyCm&9yDx%QP&m7d|SefR@=%k54?DxVsN^3(yxz<_7s@lAlojRN5+tlTd z!MQSaFz0IUH{C92u3EBW9n9}5^3?Kxx5@4d%#o+_cZ?A=L-Mcbs|1xH#ojGPye=_t zHl%BaCvb@7ws}`vgs(e0COn-BU^Bx6-zv-iXUm$|_t9CAL*GGMM(4-qT+DsE;68Va zGJiT}=-$h`6|c#yelMAR7B;zV^&wl7by@k%iS5ol7cn9@eK9fSn|Htl>m%G|uFto# zd6R9Aqg6CzhoZyJIVZQNHgv6h-3~vskxPo$7V&&B43G06Ux5@#r(^g(y8wN3-PtE@v%J$YyRy9cf)c*lV C@6OKv literal 0 HcmV?d00001 diff --git a/player/sword.png.import b/player/sword.png.import new file mode 100644 index 0000000..c45ce3f --- /dev/null +++ b/player/sword.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b8aih0qr3hssc" +path="res://.godot/imported/sword.png-af572fc4a334164c3dd0648ee3ef204d.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://player/sword.png" +dest_files=["res://.godot/imported/sword.png-af572fc4a334164c3dd0648ee3ef204d.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +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/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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/player/sword.tscn b/player/sword.tscn index 0ddd0b4..62d59d2 100644 --- a/player/sword.tscn +++ b/player/sword.tscn @@ -1,9 +1,11 @@ [gd_scene load_steps=5 format=3 uid="uid://d3e3kuyeh6mr1"] [ext_resource type="Script" uid="uid://cpyc4qqgpyx38" path="res://player/sword.gd" id="1_hv1tj"] -[ext_resource type="Texture2D" uid="uid://c4xg25s8loxp0" path="res://player/Player_Walk/Walk 1.png" id="2_hv1tj"] +[ext_resource type="Texture2D" uid="uid://b8aih0qr3hssc" path="res://player/sword.png" id="2_hv1tj"] [sub_resource type="CapsuleShape2D" id="CapsuleShape2D_e4ynd"] +radius = 18.048504 +height = 36.097008 [sub_resource type="SpriteFrames" id="SpriteFrames_fahsa"] animations = [{ @@ -22,14 +24,13 @@ collision_mask = 18 script = ExtResource("1_hv1tj") [node name="CollisionShape2D" type="CollisionShape2D" parent="."] -position = Vector2(-13, 5) +position = Vector2(-18.97778, 0.61333394) rotation = 1.5708 -scale = Vector2(-0.417, -0.985) +scale = Vector2(-0.635, -1.5) shape = SubResource("CapsuleShape2D_e4ynd") [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] -visible = false -position = Vector2(-13, 5) -rotation = 1.5708 -scale = Vector2(-0.185, -0.278) +modulate = Color(1, 1, 1, 0.6862745) +position = Vector2(-25.644447, 0.61333346) +scale = Vector2(-0.385, 0.231) sprite_frames = SubResource("SpriteFrames_fahsa") From 3ab73d7a374c9d46c625d3473c902f20a8dfc32d Mon Sep 17 00:00:00 2001 From: RealMelwei Date: Fri, 19 Sep 2025 12:09:12 +0200 Subject: [PATCH 3/3] Minor visual change --- player/sword.tscn | 1 + 1 file changed, 1 insertion(+) diff --git a/player/sword.tscn b/player/sword.tscn index 62d59d2..7b64124 100644 --- a/player/sword.tscn +++ b/player/sword.tscn @@ -30,6 +30,7 @@ scale = Vector2(-0.635, -1.5) shape = SubResource("CapsuleShape2D_e4ynd") [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] +visible = false modulate = Color(1, 1, 1, 0.6862745) position = Vector2(-25.644447, 0.61333346) scale = Vector2(-0.385, 0.231)