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 adbc15e..dd6f008 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="."] 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 0000000..85d3fe8 Binary files /dev/null and b/player/sword.png differ 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..7b64124 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,14 @@ 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")