diff --git a/.gitattributes b/.gitattributes index 6982117..3c270e6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,5 @@ # Normalize EOL for all files that Git considers text files. * text=auto eol=lf -*.gd linguist-detectable=false + +# disable addons from showing up in linguist stats +addons/* linguist-vendored diff --git a/Assets/Animations/player_hurt.res b/Assets/Animations/player_hurt.res new file mode 100644 index 0000000..e77a06f Binary files /dev/null and b/Assets/Animations/player_hurt.res differ diff --git a/Assets/Dialog/doc.dialogue.import b/Assets/Dialog/doc.dialogue.import deleted file mode 100644 index 7a77b67..0000000 --- a/Assets/Dialog/doc.dialogue.import +++ /dev/null @@ -1,15 +0,0 @@ -[remap] - -importer="dialogue_manager_compiler_8" -type="Resource" -uid="uid://dntkvjjr8mrgf" -path="res://.godot/imported/doc.dialogue-9af7b89bed22cfead99a33235819bbdf.tres" - -[deps] - -source_file="res://Assets/Dialog/doc.dialogue" -dest_files=["res://.godot/imported/doc.dialogue-9af7b89bed22cfead99a33235819bbdf.tres"] - -[params] - -defaults=true diff --git a/Assets/Dialogue/books.dialogue b/Assets/Dialogue/books.dialogue new file mode 100644 index 0000000..a8c14f5 --- /dev/null +++ b/Assets/Dialogue/books.dialogue @@ -0,0 +1,19 @@ +~ unwanted_frequencies + +Sonus Non Gratus draws upon the natural properties of shungite, a two billion-year-old rock, to create a gravitational force that collapses unwanted frequencies into a single focal point and redirecting them away from the la casa. + +=> END + +~ forsen1337 + +My fanfic (not like others) + +Hello, this is the beggining of a story/fanfic called Eolnyss, which is also the name of the world in this story where the "World government" controls cities and bigger parts of Eolnyss. + +I will give you the first, second and the third chapter too see if you like it or not (please finnish all three of them). I want to be more original then many other fan fics that copies everything. Its quiet hard to knot copy anything from different mangas/stories/mythology but I have tried my best. + +I can write english pretty good but since It is not my mothertounge I will make errors here and there. IMPORTANT\: READ ALL THREE CHAPTERS BEFORE VOTING. Enjoy. + +The dark room was clouded with smoke as the 1st lieutenant entered the room. He walked slowly , trying to avoid the big clouds, towards the black desk where a man in black cape was sitting and enjoying his last cigar. + +=> END \ No newline at end of file diff --git a/Assets/Dialogue/books.dialogue.import b/Assets/Dialogue/books.dialogue.import new file mode 100644 index 0000000..291c83f --- /dev/null +++ b/Assets/Dialogue/books.dialogue.import @@ -0,0 +1,15 @@ +[remap] + +importer="dialogue_manager_compiler_8" +type="Resource" +uid="uid://dilmuoilweoeh" +path="res://.godot/imported/books.dialogue-cc272ebae322ae3ca46820dca11a3437.tres" + +[deps] + +source_file="res://Assets/Dialogue/books.dialogue" +dest_files=["res://.godot/imported/books.dialogue-cc272ebae322ae3ca46820dca11a3437.tres"] + +[params] + +defaults=true diff --git a/Assets/Dialog/doc-first-encounter.dtl b/Assets/Dialogue/doc-first-encounter.dtl similarity index 100% rename from Assets/Dialog/doc-first-encounter.dtl rename to Assets/Dialogue/doc-first-encounter.dtl diff --git a/Assets/Dialog/doc.dialogue b/Assets/Dialogue/doc.dialogue similarity index 93% rename from Assets/Dialog/doc.dialogue rename to Assets/Dialogue/doc.dialogue index e817bc4..2452e7d 100644 --- a/Assets/Dialog/doc.dialogue +++ b/Assets/Dialogue/doc.dialogue @@ -18,7 +18,7 @@ Doc, The Two Time: Nothing but success. Doc, The Two Time: That's what my life's about. Period. Doc, The Two Time: And the arena today, ladies and gentlemen... Doc, The Two Time: is wide open, and the crowds are flooding in. VIP seating. Skybox section. Reserved for the Slick Daddy Club. -Doc, The Two Time: The Slick Daddy Club looking so damn good today. I'm feeling so damn good. It's obvious. +Doc, The Two Time: The Slick Daddy Club lofoking so damn good today. I'm feeling so damn good. It's obvious. Doc, The Two Time: The V of success. Challenge [b]Doc, The Two Time[/b] to a duel? - Yes diff --git a/Assets/Dialogue/doc.dialogue.import b/Assets/Dialogue/doc.dialogue.import new file mode 100644 index 0000000..e2f1132 --- /dev/null +++ b/Assets/Dialogue/doc.dialogue.import @@ -0,0 +1,15 @@ +[remap] + +importer="dialogue_manager_compiler_8" +type="Resource" +uid="uid://dntkvjjr8mrgf" +path="res://.godot/imported/doc.dialogue-8f95f6a09d3ac685b71d7e07c49df1c6.tres" + +[deps] + +source_file="res://Assets/Dialogue/doc.dialogue" +dest_files=["res://.godot/imported/doc.dialogue-8f95f6a09d3ac685b71d7e07c49df1c6.tres"] + +[params] + +defaults=true diff --git a/Characters/Character.cs b/Characters/Character.cs index bf9305d..a7854f4 100644 --- a/Characters/Character.cs +++ b/Characters/Character.cs @@ -152,8 +152,16 @@ public partial class Character : CharacterBody2D, IFaction public virtual void Die() { - GD.Print("lol died"); - QueueFree(); + if (HurtAnimation.HasAnimation("death")) + { + HurtAnimation.Play("death"); + HurtAnimation.AnimationFinished += (StringName name) => + QueueFree(); + } + else + { + QueueFree(); + } } public void ApplyImpulse(Vector2 impulse, bool resetVelocity = false) @@ -189,7 +197,7 @@ public partial class Character : CharacterBody2D, IFaction public void UseCurrentItem() { - if (StunTime > 0) + if (StunTime > 0 || !IsAlive) { return; } @@ -242,6 +250,12 @@ public partial class Character : CharacterBody2D, IFaction float oldHealth = Health; Health -= ReceiveDamage(damage, inflictor, knockback, knockbackDir); + var hurtParticles = GetNode("Effects/HurtParticles"); + if (hurtParticles is not null) + { + hurtParticles.SetDirection(knockbackDir); + } + // create damage text var textScene = GD.Load("res://UI/FloatingText.tscn"); var instance = textScene.Instantiate(); @@ -268,9 +282,10 @@ public partial class Character : CharacterBody2D, IFaction //plr.Camera.Shake(1, 0.4f); } - if (this.GetNode("HurtSound") is AudioStreamPlayer2D sound) + if (this.GetNode("Effects/HurtSound") is AudioStreamPlayer2D sound) { // very small pitch deviation + GD.Print("hurt sound"); sound.At(GlobalPosition).WithPitchDeviation(0.125f).PlayOneShot(); } @@ -295,6 +310,9 @@ public partial class Character : CharacterBody2D, IFaction public virtual void Footstep() { - throw new System.NotImplementedException(); + if (GetNode("Effects/Footstep") is AudioStreamPlayer2D player) + { + player.Play(); + } } } diff --git a/Characters/Doc.cs b/Characters/Doc.cs index 18b4c8e..9d3c061 100644 --- a/Characters/Doc.cs +++ b/Characters/Doc.cs @@ -2,7 +2,6 @@ using Godot; using GodotUtilities; using SupaLidlGame.Extensions; using SupaLidlGame.State.Character; -using DialogueManagerRuntime; namespace SupaLidlGame.Characters; @@ -81,7 +80,7 @@ public partial class Doc : Boss _dashState = StateMachine.FindChildOfType(); _originalDashModifier = _dashState.VelocityModifier; - var dialog = GD.Load("res://Assets/Dialog/doc.dialogue"); + var dialog = GD.Load("res://Assets/Dialogue/doc.dialogue"); GetNode("InteractionTrigger") .Interaction += () => @@ -139,6 +138,7 @@ public partial class Doc : Boss return 1; } + /* public override void OnReceivedDamage( float damage, Character inflictor, @@ -150,6 +150,7 @@ public partial class Doc : Boss base.OnReceivedDamage(damage, inflictor, knockback, knockbackDir); } + */ protected override void Think() { @@ -181,8 +182,12 @@ public partial class Doc : Boss bool shouldDashAway = false; bool shouldDashTowards = false; - var lance = Inventory.SelectedItem as Items.Weapons.Sword; - var lanceState = lance.StateMachine.CurrentState; + var lanceState = Lance.StateMachine.CurrentState; + + if (Inventory.SelectedItem != Lance) + { + Inventory.SelectedItem = Lance; + } float dot = Direction.Normalized() .Dot(bestTarget.Direction.Normalized()); diff --git a/Characters/Doc.tscn b/Characters/Doc.tscn index 28576e7..d504080 100644 --- a/Characters/Doc.tscn +++ b/Characters/Doc.tscn @@ -726,6 +726,9 @@ stream = ExtResource("26_js7p2") volume_db = 3.0 attenuation = 0.5 +[node name="HurtSound" type="AudioStreamPlayer2D" parent="Effects"] +stream = ExtResource("9_stm0e") + [node name="Sprite" type="Sprite2D" parent="."] modulate = Color(1, 1, 1, 0.5) y_sort_enabled = true @@ -753,16 +756,14 @@ script = ExtResource("8_r8ejq") Items = Array[Node2D]([]) [node name="DocLance" parent="Inventory" instance=ExtResource("24_2es2r")] +unique_name_in_owner = true [node name="DocLanceHold" parent="Inventory" instance=ExtResource("26_0tntj")] -[node name="HurtSound" type="AudioStreamPlayer2D" parent="."] -stream = ExtResource("9_stm0e") - [node name="InteractionTrigger" parent="." instance=ExtResource("33_08dyq")] [node name="CollisionShape2D" parent="InteractionTrigger" index="0"] -position = Vector2(0, -8) +position = Vector2(0, -6) shape = SubResource("CircleShape2D_8hwat") [editable path="Hurtbox"] diff --git a/Characters/ExampleEnemy.tscn b/Characters/ExampleEnemy.tscn index 88734cd..e22addb 100644 --- a/Characters/ExampleEnemy.tscn +++ b/Characters/ExampleEnemy.tscn @@ -16,6 +16,44 @@ resource_local_to_scene = true shader = ExtResource("1_fx1w5") shader_parameter/color = Quaternion(1, 1, 1, 1) shader_parameter/intensity = 0.0 +shader_parameter/alpha_modulate = 1.0 + +[sub_resource type="Animation" id="Animation_k6l16"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:material:shader_parameter/intensity") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [0.0] +} + +[sub_resource type="Animation" id="Animation_dxevc"] +resource_name = "hurt" +length = 0.6 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:material:shader_parameter/intensity") +tracks/0/interp = 2 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6), +"transitions": PackedFloat32Array(4, 4, 4, 4, 4, 4, 4), +"update": 0, +"values": [0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_xe5eq"] +_data = { +"RESET": SubResource("Animation_k6l16"), +"hurt": SubResource("Animation_dxevc") +} [sub_resource type="AtlasTexture" id="AtlasTexture_55yt4"] atlas = ExtResource("3_ocaae") @@ -93,43 +131,6 @@ size = Vector2(16, 8) [sub_resource type="RectangleShape2D" id="RectangleShape2D_8lxmf"] size = Vector2(16, 18) -[sub_resource type="Animation" id="Animation_dxevc"] -resource_name = "Hurt" -length = 0.6 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath(".:material:shader_parameter/intensity") -tracks/0/interp = 2 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6), -"transitions": PackedFloat32Array(4, 4, 4, 4, 4, 4, 4), -"update": 0, -"values": [0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0] -} - -[sub_resource type="Animation" id="Animation_k6l16"] -length = 0.001 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath(".:material:shader_parameter/intensity") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 0, -"values": [0.0] -} - -[sub_resource type="AnimationLibrary" id="AnimationLibrary_xe5eq"] -_data = { -"Hurt": SubResource("Animation_dxevc"), -"RESET": SubResource("Animation_k6l16") -} - [node name="ExampleEnemy" type="CharacterBody2D" node_paths=PackedStringArray("Sprite", "Inventory", "StateMachine", "Hurtbox")] y_sort_enabled = true texture_filter = 3 @@ -159,6 +160,14 @@ script = ExtResource("6_73mr6") IdleState = NodePath("../Idle") Character = NodePath("../..") +[node name="Animations" type="Node" parent="."] + +[node name="HurtAnimation" type="AnimationPlayer" parent="Animations"] +root_node = NodePath("../..") +libraries = { +"": SubResource("AnimationLibrary_xe5eq") +} + [node name="Sprite" type="AnimatedSprite2D" parent="."] use_parent_material = true position = Vector2(0, -4) @@ -184,11 +193,6 @@ script = ExtResource("7_43gq8") [node name="Sword" parent="Inventory" instance=ExtResource("8_s3c8r")] Knockback = 100.0 -[node name="FlashAnimation" type="AnimationPlayer" parent="."] -libraries = { -"": SubResource("AnimationLibrary_xe5eq") -} - [node name="HurtSound" type="AudioStreamPlayer2D" parent="."] stream = ExtResource("10_n1e64") diff --git a/Characters/NPC.cs b/Characters/NPC.cs index f903d7e..09c4165 100644 --- a/Characters/NPC.cs +++ b/Characters/NPC.cs @@ -1,4 +1,4 @@ -#undef DEBUG_NPC +#define DEBUG_NPC using Godot; using SupaLidlGame.Extensions; @@ -43,6 +43,9 @@ public partial class NPC : Character } } + [Export] + public Items.Item DefaultSelectedItem { get; set; } + public bool ShouldMove { get; set; } = true; public bool CanAttack { get; set; } = true; @@ -67,11 +70,16 @@ public partial class NPC : Character { base._Ready(); Array.Fill(_weights, 0); + + if (DefaultSelectedItem is not null) + { + Inventory.SelectedItem = DefaultSelectedItem; + } } public override void _Draw() { -#if DEBUG_NPC +#if DEBUG for (int i = 0; i < 16; i++) { Vector2 vec = _weightDirs[i] * _weights[i] * 32; @@ -92,7 +100,7 @@ public partial class NPC : Character base._Draw(); } - protected virtual Character FindBestTarget() + public virtual Character FindBestTarget() { float bestDist = float.MaxValue; Character bestChar = null; @@ -100,7 +108,8 @@ public partial class NPC : Character { if (node is Character character) { - if (character.Faction == Faction || character.Health <= 0) + bool isFriendly = character.Faction == Faction; + if (isFriendly || character.Health <= 0) { continue; } diff --git a/Characters/Player.tscn b/Characters/Player.tscn index cc9b366..f1c7106 100644 --- a/Characters/Player.tscn +++ b/Characters/Player.tscn @@ -1,10 +1,11 @@ -[gd_scene load_steps=59 format=3 uid="uid://b2254pup8k161"] +[gd_scene load_steps=57 format=3 uid="uid://b2254pup8k161"] [ext_resource type="Script" path="res://Characters/Player.cs" id="1_flygr"] [ext_resource type="Shader" path="res://Shaders/Flash.gdshader" id="2_ngsgt"] [ext_resource type="Texture2D" uid="uid://bej8thq7ruyty" path="res://Assets/Sprites/Characters/forsen2.png" id="4_5vird"] [ext_resource type="PackedScene" uid="uid://cl56eadpklnbo" path="res://Utils/PlayerCamera.tscn" id="4_ym125"] [ext_resource type="Script" path="res://State/Character/CharacterStateMachine.cs" id="5_rgckv"] +[ext_resource type="Script" path="res://State/Character/CharacterDashState.cs" id="6_rft7p"] [ext_resource type="Script" path="res://State/Character/PlayerIdleState.cs" id="6_wkfdm"] [ext_resource type="PackedScene" uid="uid://dvqap2uhcah63" path="res://Items/Weapons/Sword.tscn" id="7_4rxuv"] [ext_resource type="Script" path="res://State/Character/PlayerMoveState.cs" id="7_dfqd8"] @@ -15,6 +16,7 @@ [ext_resource type="Material" uid="uid://x5qcq5muvc3g" path="res://Assets/Sprites/Particles/PlayerDamageProcessMaterial.tres" id="8_yf112"] [ext_resource type="Texture2D" uid="uid://c1a7lvb4uuwfy" path="res://Assets/Sprites/Particles/circle-16.png" id="9_7gumm"] [ext_resource type="PackedScene" uid="uid://cjgxyhgcyvsv7" path="res://BoundingBoxes/Hurtbox.tscn" id="9_avyu4"] +[ext_resource type="AnimationLibrary" uid="uid://epe31b7x1nt1" path="res://Assets/Animations/player_hurt.res" id="9_g42dl"] [ext_resource type="Material" uid="uid://ra02tvwd5o5g" path="res://Assets/Sprites/Particles/PlayerDeathProcessMaterial.tres" id="10_agw51"] [ext_resource type="AudioStream" uid="uid://bbqdpexvknma2" path="res://Assets/Sounds/never-lucky.mp3" id="12_vd7j4"] [ext_resource type="AudioStream" uid="uid://bkeyg8weaqnuu" path="res://Assets/Sounds/splat-player.ogg" id="12_vvem5"] @@ -151,6 +153,7 @@ _data = { } [sub_resource type="Animation" id="Animation_adxyh"] +resource_local_to_scene = true length = 0.001 tracks/0/type = "value" tracks/0/imported = false @@ -187,203 +190,6 @@ _data = { "sword": SubResource("Animation_3w3u1") } -[sub_resource type="Animation" id="Animation_k6l16"] -length = 0.001 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath(".:material:shader_parameter/intensity") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 0, -"values": [0.0] -} -tracks/1/type = "value" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath("Sprites/Node2D/Character:frame") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 1, -"values": [0] -} -tracks/2/type = "value" -tracks/2/imported = false -tracks/2/enabled = true -tracks/2/path = NodePath("Effects/HurtParticles:emitting") -tracks/2/interp = 1 -tracks/2/loop_wrap = true -tracks/2/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 1, -"values": [false] -} -tracks/3/type = "value" -tracks/3/imported = false -tracks/3/enabled = true -tracks/3/path = NodePath(".:material:shader_parameter/alpha_modulate") -tracks/3/interp = 1 -tracks/3/loop_wrap = true -tracks/3/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 0, -"values": [1.0] -} -tracks/4/type = "value" -tracks/4/imported = false -tracks/4/enabled = true -tracks/4/path = NodePath("Effects/DeathParticles:emitting") -tracks/4/interp = 1 -tracks/4/loop_wrap = true -tracks/4/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 1, -"values": [false] -} - -[sub_resource type="Animation" id="Animation_vtf8v"] -resource_name = "death" -length = 3.0 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("Sprites/Node2D/Character:frame") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0, 0.1, 0.2, 0.3), -"transitions": PackedFloat32Array(1, 1, 1, 1), -"update": 1, -"values": [11, 15, 16, 17] -} -tracks/1/type = "value" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath("Effects/DeathParticles:emitting") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/keys = { -"times": PackedFloat32Array(1), -"transitions": PackedFloat32Array(1), -"update": 1, -"values": [true] -} -tracks/2/type = "value" -tracks/2/imported = false -tracks/2/enabled = true -tracks/2/path = NodePath(".:material:shader_parameter/alpha_modulate") -tracks/2/interp = 1 -tracks/2/loop_wrap = true -tracks/2/keys = { -"times": PackedFloat32Array(1, 1.2), -"transitions": PackedFloat32Array(1, 1), -"update": 0, -"values": [1.0, 0.0] -} -tracks/3/type = "method" -tracks/3/imported = false -tracks/3/enabled = true -tracks/3/path = NodePath("Effects/DeathCry") -tracks/3/interp = 1 -tracks/3/loop_wrap = true -tracks/3/keys = { -"times": PackedFloat32Array(0.3), -"transitions": PackedFloat32Array(1), -"values": [{ -"args": [0.0], -"method": &"play" -}] -} - -[sub_resource type="Animation" id="Animation_dxevc"] -resource_name = "hurt" -length = 0.2 -step = 0.05 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath(".:material:shader_parameter/intensity") -tracks/0/interp = 2 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0, 0.05, 0.1, 0.2), -"transitions": PackedFloat32Array(4, 4, 4, 4), -"update": 0, -"values": [1.0, 0.0, 1.0, 0.0] -} -tracks/1/type = "value" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath("Sprites/Node2D/Character:frame") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 1, -"values": [11] -} -tracks/2/type = "value" -tracks/2/imported = false -tracks/2/enabled = true -tracks/2/path = NodePath("Effects/HurtParticles:emitting") -tracks/2/interp = 1 -tracks/2/loop_wrap = true -tracks/2/keys = { -"times": PackedFloat32Array(0, 0.1), -"transitions": PackedFloat32Array(1, 1), -"update": 1, -"values": [true, false] -} -tracks/3/type = "method" -tracks/3/imported = false -tracks/3/enabled = true -tracks/3/path = NodePath("Effects/HurtParticles") -tracks/3/interp = 1 -tracks/3/loop_wrap = true -tracks/3/keys = { -"times": PackedFloat32Array(0.2), -"transitions": PackedFloat32Array(1), -"values": [{ -"args": [], -"method": &"restart" -}] -} - -[sub_resource type="Animation" id="Animation_pjey7"] -resource_name = "hurt_flash" -length = 0.4 -step = 0.05 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath(".:material:shader_parameter/intensity") -tracks/0/interp = 2 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0, 0.2, 0.4), -"transitions": PackedFloat32Array(4, 4, 4), -"update": 0, -"values": [0.0, 1.0, 0.0] -} - -[sub_resource type="AnimationLibrary" id="AnimationLibrary_xe5eq"] -_data = { -"RESET": SubResource("Animation_k6l16"), -"death": SubResource("Animation_vtf8v"), -"hurt": SubResource("Animation_dxevc"), -"hurt_flash": SubResource("Animation_pjey7") -} - [sub_resource type="AnimationLibrary" id="AnimationLibrary_kks2p"] _data = { "stun": ExtResource("8_m08fh") @@ -468,6 +274,10 @@ font_size = 24 [sub_resource type="RectangleShape2D" id="RectangleShape2D_cjk6b"] size = Vector2(8, 8) +[sub_resource type="OccluderPolygon2D" id="OccluderPolygon2D_7482j"] +closed = false +polygon = PackedVector2Array(-3, 0, 2, 0) + [node name="Player" type="CharacterBody2D" node_paths=PackedStringArray("Camera", "DirectionMarker", "Sprite", "Inventory", "StateMachine", "Hurtbox")] y_sort_enabled = true texture_filter = 3 @@ -495,18 +305,27 @@ MoveState = NodePath("../Move") IdleState = NodePath(".") Character = NodePath("../..") -[node name="Move" type="Node" parent="StateMachine" node_paths=PackedStringArray("RollState", "IdleState", "Character")] +[node name="Move" type="Node" parent="StateMachine" node_paths=PackedStringArray("RollState", "DashState", "IdleState", "Character")] script = ExtResource("7_dfqd8") RollState = NodePath("../Roll") +DashState = NodePath("../Dash") IdleState = NodePath("../Idle") Character = NodePath("../..") +[node name="Dash" type="Node" parent="StateMachine" node_paths=PackedStringArray("IdleState", "Character")] +script = ExtResource("6_rft7p") +IdleState = NodePath("../Idle") +TimeToDash = 0.1 +VelocityModifier = 5.0 +Character = NodePath("../..") + [node name="Roll" type="Node" parent="StateMachine" node_paths=PackedStringArray("IdleState", "Character")] script = ExtResource("8_fy0v5") IdleState = NodePath("../Idle") Character = NodePath("../..") [node name="Animations" type="Node" parent="."] +unique_name_in_owner = true script = ExtResource("7_sdgvb") [node name="Movement" type="AnimationPlayer" parent="Animations"] @@ -522,7 +341,7 @@ libraries = { [node name="Hurt" type="AnimationPlayer" parent="Animations"] root_node = NodePath("../..") libraries = { -"": SubResource("AnimationLibrary_xe5eq") +"": ExtResource("9_g42dl") } [node name="Stun" type="AnimationPlayer" parent="Animations"] @@ -539,6 +358,7 @@ parameters/conditions/move = false parameters/conditions/roll = false [node name="Effects" type="Node2D" parent="."] +unique_name_in_owner = true [node name="RollParticles" type="GPUParticles2D" parent="Effects"] emitting = false @@ -574,14 +394,15 @@ volume_db = 2.0 [node name="Footstep" type="AudioStreamPlayer2D" parent="Effects"] stream = ExtResource("13_bxguv") +[node name="HurtSound" type="AudioStreamPlayer2D" parent="Effects"] +stream = ExtResource("12_vvem5") + [node name="Camera2D" parent="." instance=ExtResource("4_ym125")] -limit_left = -256 -limit_top = -256 -limit_right = 256 -limit_bottom = 256 +limit_smoothed = true position_smoothing_speed = 8.0 [node name="Sprites" type="Node2D" parent="."] +unique_name_in_owner = true y_sort_enabled = true use_parent_material = true rotation = 6.28319 @@ -641,11 +462,6 @@ shape = SubResource("RectangleShape2D_cjk6b") [node name="Timer" type="Timer" parent="Hurtbox"] one_shot = true -[node name="HurtSound" type="AudioStreamPlayer2D" parent="."] -visible = false -stream = ExtResource("12_vvem5") -max_distance = 64.0 - [node name="AudioListener2D" type="AudioListener2D" parent="."] visible = false current = true @@ -655,7 +471,6 @@ visible = false position = Vector2(0, 6) [node name="InteractionRay" type="RayCast2D" parent="Direction2D"] -visible = false target_position = Vector2(16, 0) collision_mask = 64 collide_with_areas = true @@ -663,6 +478,7 @@ script = ExtResource("13_hs3u1") [node name="PointLight2D" type="PointLight2D" parent="."] visible = false +position = Vector2(0, -8) blend_mode = 2 shadow_enabled = true shadow_filter = 2 @@ -673,4 +489,8 @@ height = 10.0 [node name="DamageTime" type="Node" parent="."] script = ExtResource("15_4xl06") +[node name="LightOccluder2D" type="LightOccluder2D" parent="."] +occluder = SubResource("OccluderPolygon2D_7482j") +occluder_light_mask = 8 + [editable path="Hurtbox"] diff --git a/Entities/Torch.tscn b/Entities/Torch.tscn index 6aee75c..5753fd7 100644 --- a/Entities/Torch.tscn +++ b/Entities/Torch.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=11 format=3 uid="uid://c1w7t6irnohfx"] [ext_resource type="Texture2D" uid="uid://har1bd5u4dq3" path="res://Assets/Sprites/Misc/torch.png" id="1_14bgb"] -[ext_resource type="Texture2D" uid="uid://b8ann6yb8qox4" path="res://Assets/Sprites/Particles/light-pixel.png" id="2_f0xs8"] +[ext_resource type="Texture2D" uid="uid://coarr28adgo1u" path="res://Assets/Sprites/Particles/point-light.png" id="2_hotvd"] [sub_resource type="AtlasTexture" id="AtlasTexture_js1l1"] atlas = ExtResource("1_14bgb") @@ -64,15 +64,16 @@ animations = [{ [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] texture_filter = 1 -position = Vector2(0, -12) +position = Vector2(0, -10) sprite_frames = SubResource("SpriteFrames_gf7ku") autoplay = "default" frame_progress = 0.337799 [node name="PointLight2D" type="PointLight2D" parent="."] -color = Color(1, 0.898039, 0.686275, 1) +color = Color(1, 0.976471, 0.92549, 1) blend_mode = 2 shadow_enabled = true shadow_filter_smooth = 3.0 -texture = ExtResource("2_f0xs8") +texture = ExtResource("2_hotvd") offset = Vector2(0, 2) +texture_scale = 0.25 diff --git a/Entities/TorchLamp.tscn b/Entities/TorchLamp.tscn index 973648d..11df0f7 100644 --- a/Entities/TorchLamp.tscn +++ b/Entities/TorchLamp.tscn @@ -107,7 +107,7 @@ frame_progress = 0.743234 offset = Vector2(0, -12) [node name="PointLight2D" type="PointLight2D" parent="."] -color = Color(1, 0.803922, 0.698039, 1) +color = Color(1, 0.9525, 0.85, 1) energy = 1.2 blend_mode = 2 shadow_filter_smooth = 3.0 diff --git a/Entities/UnwantedFrequency.cs b/Entities/UnwantedFrequency.cs index 5a1f8a4..53e00ee 100644 --- a/Entities/UnwantedFrequency.cs +++ b/Entities/UnwantedFrequency.cs @@ -1,12 +1,11 @@ using Godot; -using SupaLidlGame.Extensions; namespace SupaLidlGame.Entities; -public partial class UnwantedFrequency : Projectile +public partial class UnwantedFrequency : Projectile, Utils.ITarget { [Export] - public Characters.Character Homing { get; set; } + public Characters.Character CharacterTarget { get; set; } [Export] public float HomingVelocity { get; set; } = 1; @@ -46,17 +45,10 @@ public partial class UnwantedFrequency : Projectile TrailRotation.Rotation = Direction.Angle(); TrailPosition.Position = new Vector2(0, 4 * Mathf.Sin(radians)); - // home towards player - if (Homing is not null) + if (CharacterTarget is not null) { - var desired = GlobalPosition.DirectionTo(Homing.GlobalPosition); - //var steer = (desired - Direction) * HomingVelocity * (float)delta; - //float dTheta = Direction.AngleTo(dirToHoming); - //float dTheta = Mathf.Acos(Direction.Dot(dirToHoming)); - - //float max = (float)(delta * HomingRotationalVelocity); - //float rotVel = Mathf.Clamp(dTheta, -max, max); - + var pos = CharacterTarget.GlobalPosition; + var desired = GlobalPosition.DirectionTo(pos); Direction += (desired - Direction) * HomingVelocity * (float)delta; } diff --git a/Items/Weapons/Sword.tscn b/Items/Weapons/Sword.tscn index c9d0d02..555fb1c 100644 --- a/Items/Weapons/Sword.tscn +++ b/Items/Weapons/Sword.tscn @@ -353,13 +353,12 @@ graph_offset = Vector2(0, -104.073) [sub_resource type="AnimationNodeStateMachinePlayback" id="AnimationNodeStateMachinePlayback_o5g2u"] -[node name="Sword" type="Node2D" node_paths=PackedStringArray("Hitbox", "AnimationPlayer", "AnimationTree", "ParryParticles", "StateMachine", "Anchor", "HandAnchor")] +[node name="Sword" type="Node2D" node_paths=PackedStringArray("Hitbox", "AnimationPlayer", "ParryParticles", "StateMachine", "Anchor", "HandAnchor")] y_sort_enabled = true texture_filter = 3 script = ExtResource("1_mlo73") Hitbox = NodePath("Hitbox") AnimationPlayer = NodePath("AnimationPlayer") -AnimationTree = NodePath("AnimationTree") AttackTime = 0.2 AttackAnimationDuration = 0.75 ParryParticles = NodePath("Anchor/Node2D/Sprite2D/ParryParticles") @@ -386,10 +385,9 @@ script = ExtResource("4_j3cud") Sword = NodePath("../..") AttackState = NodePath("../Attack") -[node name="Attack" type="Node" parent="State" node_paths=PackedStringArray("Sword", "AnticipateState", "IdleState")] +[node name="Attack" type="Node" parent="State" node_paths=PackedStringArray("Sword", "IdleState")] script = ExtResource("5_hmisb") Sword = NodePath("../..") -AnticipateState = NodePath("../Anticipate") IdleState = NodePath("../Idle") [node name="WorldEnvironment" type="WorldEnvironment" parent="."] @@ -461,10 +459,8 @@ hframes = 5 [node name="SwingSound" type="AudioStreamPlayer2D" parent="."] stream = ExtResource("10_mfnl7") -max_distance = 256.0 [node name="ParrySound" type="AudioStreamPlayer2D" parent="."] stream = ExtResource("6_8nxjm") -max_distance = 256.0 [editable path="Hitbox"] diff --git a/Scenes/BaseMap.tscn b/Scenes/BaseMap.tscn index 266d8d9..983ccfa 100644 --- a/Scenes/BaseMap.tscn +++ b/Scenes/BaseMap.tscn @@ -1837,30 +1837,30 @@ y_sort_enabled = true texture_filter = 3 tile_set = SubResource("TileSet_18c7j") format = 2 -layer_0/name = "Walls" +layer_0/name = "Layer 3" layer_0/y_sort_enabled = true -layer_1/name = "Ground 2" +layer_1/name = "Layer 2" layer_1/enabled = true layer_1/modulate = Color(1, 1, 1, 1) layer_1/y_sort_enabled = true layer_1/y_sort_origin = 0 layer_1/z_index = -1 layer_1/tile_data = PackedInt32Array() -layer_2/name = "Ground Paths" +layer_2/name = "Layer 1 Overlay" layer_2/enabled = true layer_2/modulate = Color(1, 1, 1, 1) layer_2/y_sort_enabled = true layer_2/y_sort_origin = 0 layer_2/z_index = -1 layer_2/tile_data = PackedInt32Array() -layer_3/name = "Ground" +layer_3/name = "Layer 1" layer_3/enabled = true layer_3/modulate = Color(1, 1, 1, 1) layer_3/y_sort_enabled = true layer_3/y_sort_origin = 0 layer_3/z_index = -2 layer_3/tile_data = PackedInt32Array() -layer_4/name = "Lower 2" +layer_4/name = "Layer 0" layer_4/enabled = true layer_4/modulate = Color(1, 1, 1, 1) layer_4/y_sort_enabled = true @@ -1881,6 +1881,8 @@ Spawners = NodePath("Spawners") [node name="CanvasModulate" type="CanvasModulate" parent="."] +[node name="Static" type="Node2D" parent="."] + [node name="Entities" type="Node2D" parent="."] y_sort_enabled = true diff --git a/Scenes/Level.tscn b/Scenes/Level.tscn index eb51199..5032ba1 100644 --- a/Scenes/Level.tscn +++ b/Scenes/Level.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=7 format=3 uid="uid://1pb3mpmrl7lc"] [ext_resource type="Script" path="res://Utils/World.cs" id="1_1k6ew"] -[ext_resource type="PackedScene" uid="uid://b2x17su05ou5w" path="res://Scenes/Maps/Arena.tscn" id="2_avsrq"] +[ext_resource type="PackedScene" uid="uid://b2x17su05ou5w" path="res://Scenes/Maps/Arena.tscn" id="2_lddbd"] [ext_resource type="PackedScene" uid="uid://bxo553hblp6nf" path="res://UI/HealthBar.tscn" id="3_5rhge"] [ext_resource type="Script" path="res://UI/UIController.cs" id="3_fe62s"] [ext_resource type="PackedScene" uid="uid://01d24ij5av1y" path="res://UI/BossBar.tscn" id="5_8njq4"] @@ -9,7 +9,7 @@ [node name="World" type="Node2D" node_paths=PackedStringArray("UIController", "MusicPlayer", "DialogueBalloon")] script = ExtResource("1_1k6ew") -StartingArea = ExtResource("2_avsrq") +StartingArea = ExtResource("2_lddbd") UIController = NodePath("CanvasLayer/UI") MusicPlayer = NodePath("MusicPlayer") DialogueBalloon = NodePath("DialogBalloon") diff --git a/Scenes/Map.cs b/Scenes/Map.cs index 3432ec2..50fdcae 100644 --- a/Scenes/Map.cs +++ b/Scenes/Map.cs @@ -19,6 +19,15 @@ public partial class Map : TileMap [Export] public Vector2 CameraUpperBound { get; set; } + [Export] + public Color ClearColor { get; set; } + + [Export] + public string AreaName { get; set; } + + [Export] + public string MapName { get; set; } + private bool _active; public bool Active @@ -44,6 +53,11 @@ public partial class Map : TileMap base._Process(delta); } + public void Load() + { + Godot.RenderingServer.SetDefaultClearColor(ClearColor); + } + public Node SpawnEntity(PackedScene scene) { var instance = scene.Instantiate(); diff --git a/State/Character/CharacterState.cs b/State/Character/CharacterState.cs index 7632a4a..6491763 100644 --- a/State/Character/CharacterState.cs +++ b/State/Character/CharacterState.cs @@ -46,7 +46,7 @@ public abstract partial class CharacterState : Node, IState public virtual CharacterState PhysicsProcess(double delta) { - if (Character.Health < 0) + if (!Character.IsAlive) { Character.Velocity = Vector2.Zero; Character.MoveAndSlide(); diff --git a/State/Character/PlayerMoveState.cs b/State/Character/PlayerMoveState.cs index 64d3732..9dae222 100644 --- a/State/Character/PlayerMoveState.cs +++ b/State/Character/PlayerMoveState.cs @@ -7,6 +7,9 @@ public partial class PlayerMoveState : PlayerState [Export] public PlayerRollState RollState { get; set; } + [Export] + public CharacterDashState DashState { get; set; } + public double MoveDuration { get; private set; } public override IState Enter(IState previousState) diff --git a/State/NPC/Doc/DocShungiteDartState.cs b/State/NPC/Doc/DocShungiteDartState.cs index 417d10c..0404c9c 100644 --- a/State/NPC/Doc/DocShungiteDartState.cs +++ b/State/NPC/Doc/DocShungiteDartState.cs @@ -41,7 +41,7 @@ public partial class DocShungiteDartState : DocAttackState protected override void Attack() { - var player = _world.CurrentPlayer; + var player = NPC.FindBestTarget(); var playerPos = player.GlobalPosition; // global position is (from npc to player) * 2 = (2 * npc) - player //projectile.GlobalPosition = 2 * NPC.GlobalPosition - playerPos; diff --git a/State/NPC/Doc/DocShungiteSpikeState.cs b/State/NPC/Doc/DocShungiteSpikeState.cs index eb884f3..df96d4b 100644 --- a/State/NPC/Doc/DocShungiteSpikeState.cs +++ b/State/NPC/Doc/DocShungiteSpikeState.cs @@ -48,7 +48,7 @@ public partial class DocShungiteSpikeState : DocShungiteDartState protected override void Attack() { - var player = _world.CurrentPlayer; + var player = NPC.FindBestTarget(); var playerPos = player.GlobalPosition; var docPos = NPC.GlobalPosition; var projectile = SpawnProjectile(docPos, Vector2.Zero) as ShungiteSpike; diff --git a/State/NPC/Doc/DocUnwantedFrequencyState.cs b/State/NPC/Doc/DocUnwantedFrequencyState.cs index ea0e85f..bfeb2aa 100644 --- a/State/NPC/Doc/DocUnwantedFrequencyState.cs +++ b/State/NPC/Doc/DocUnwantedFrequencyState.cs @@ -38,7 +38,7 @@ public partial class DocUnwantedFrequencyState : DocShungiteSpikeState var docPos = NPC.GlobalPosition; var projectile = SpawnProjectile(docPos, docPos.DirectionTo(playerPos)) as UnwantedFrequency; - projectile.Homing = player; + projectile.CharacterTarget = NPC.FindBestTarget(); _currentAttackDuration = 1; _currentAttacks++; diff --git a/Utils/ITarget.cs b/Utils/ITarget.cs new file mode 100644 index 0000000..8ff004a --- /dev/null +++ b/Utils/ITarget.cs @@ -0,0 +1,6 @@ +namespace SupaLidlGame.Utils; + +public interface ITarget +{ + public Characters.Character CharacterTarget { get; set; } +} diff --git a/Utils/World.cs b/Utils/World.cs index 621d291..828fc22 100644 --- a/Utils/World.cs +++ b/Utils/World.cs @@ -121,6 +121,7 @@ public partial class World : Node2D CurrentMap = map; CurrentMap.Active = true; + CurrentMap.Load(); if (CurrentPlayer is not null) { diff --git a/default_bus_layout.tres b/default_bus_layout.tres index b710e55..b3e4feb 100644 --- a/default_bus_layout.tres +++ b/default_bus_layout.tres @@ -1,3 +1,21 @@ [gd_resource type="AudioBusLayout" format=3 uid="uid://ljp6denwxmye"] [resource] +bus/1/name = &"Ambient" +bus/1/solo = false +bus/1/mute = false +bus/1/bypass_fx = false +bus/1/volume_db = 0.0 +bus/1/send = &"Master" +bus/2/name = &"Music" +bus/2/solo = false +bus/2/mute = false +bus/2/bypass_fx = false +bus/2/volume_db = 0.0 +bus/2/send = &"Master" +bus/3/name = &"Effects" +bus/3/solo = false +bus/3/mute = false +bus/3/bypass_fx = false +bus/3/volume_db = 0.0 +bus/3/send = &"Master" diff --git a/project.godot b/project.godot index ef6983a..e741e62 100644 --- a/project.godot +++ b/project.godot @@ -24,6 +24,7 @@ GlobalState="*res://State/Global/GlobalState.cs" [dialogue_manager] general/states=["GlobalState"] +general/wrap_lines=true [display] @@ -105,10 +106,11 @@ equip_3={ [internationalization] -locale/translations_pot_files=PackedStringArray("res://Assets/Dialog/doc.dialogue") +locale/translations_pot_files=PackedStringArray("res://Assets/Dialog/doc.dialogue", "res://Assets/Dialogue/doc.dialogue", "res://Assets/Dialogue/spellbook.dialogue", "res://Assets/Dialogue/books.dialogue") [layer_names] +2d_render/layer_4="Godray Occluder" 2d_physics/layer_1="World" 2d_physics/layer_2="Character" 2d_physics/layer_3="Player" @@ -123,4 +125,5 @@ locale/translations_pot_files=PackedStringArray("res://Assets/Dialog/doc.dialogu [rendering] +textures/canvas_textures/default_texture_filter=0 environment/defaults/default_clear_color=Color(0.301961, 0.301961, 0.301961, 1)