character updates

godot-4.1.1
John Montagu, the 4th Earl of Sandvich 2023-07-31 01:12:47 -07:00
parent d9b9825731
commit 4a4d1b2062
Signed by: sandvich
GPG Key ID: 9A39BE37E602B22D
30 changed files with 251 additions and 322 deletions

4
.gitattributes vendored
View File

@ -1,3 +1,5 @@
# Normalize EOL for all files that Git considers text files. # Normalize EOL for all files that Git considers text files.
* text=auto eol=lf * text=auto eol=lf
*.gd linguist-detectable=false
# disable addons from showing up in linguist stats
addons/* linguist-vendored

Binary file not shown.

View File

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

View File

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

View File

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

View File

@ -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: That's what my life's about. Period.
Doc, The Two Time: And the arena today, ladies and gentlemen... 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: 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. Doc, The Two Time: The V of success.
Challenge [b]Doc, The Two Time[/b] to a duel? Challenge [b]Doc, The Two Time[/b] to a duel?
- Yes - Yes

View File

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

View File

@ -152,8 +152,16 @@ public partial class Character : CharacterBody2D, IFaction
public virtual void Die() public virtual void Die()
{ {
GD.Print("lol died"); if (HurtAnimation.HasAnimation("death"))
QueueFree(); {
HurtAnimation.Play("death");
HurtAnimation.AnimationFinished += (StringName name) =>
QueueFree();
}
else
{
QueueFree();
}
} }
public void ApplyImpulse(Vector2 impulse, bool resetVelocity = false) public void ApplyImpulse(Vector2 impulse, bool resetVelocity = false)
@ -189,7 +197,7 @@ public partial class Character : CharacterBody2D, IFaction
public void UseCurrentItem() public void UseCurrentItem()
{ {
if (StunTime > 0) if (StunTime > 0 || !IsAlive)
{ {
return; return;
} }
@ -242,6 +250,12 @@ public partial class Character : CharacterBody2D, IFaction
float oldHealth = Health; float oldHealth = Health;
Health -= ReceiveDamage(damage, inflictor, knockback, knockbackDir); Health -= ReceiveDamage(damage, inflictor, knockback, knockbackDir);
var hurtParticles = GetNode<GpuParticles2D>("Effects/HurtParticles");
if (hurtParticles is not null)
{
hurtParticles.SetDirection(knockbackDir);
}
// create damage text // create damage text
var textScene = GD.Load<PackedScene>("res://UI/FloatingText.tscn"); var textScene = GD.Load<PackedScene>("res://UI/FloatingText.tscn");
var instance = textScene.Instantiate<UI.FloatingText>(); var instance = textScene.Instantiate<UI.FloatingText>();
@ -268,9 +282,10 @@ public partial class Character : CharacterBody2D, IFaction
//plr.Camera.Shake(1, 0.4f); //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 // very small pitch deviation
GD.Print("hurt sound");
sound.At(GlobalPosition).WithPitchDeviation(0.125f).PlayOneShot(); sound.At(GlobalPosition).WithPitchDeviation(0.125f).PlayOneShot();
} }
@ -295,6 +310,9 @@ public partial class Character : CharacterBody2D, IFaction
public virtual void Footstep() public virtual void Footstep()
{ {
throw new System.NotImplementedException(); if (GetNode("Effects/Footstep") is AudioStreamPlayer2D player)
{
player.Play();
}
} }
} }

View File

@ -2,7 +2,6 @@ using Godot;
using GodotUtilities; using GodotUtilities;
using SupaLidlGame.Extensions; using SupaLidlGame.Extensions;
using SupaLidlGame.State.Character; using SupaLidlGame.State.Character;
using DialogueManagerRuntime;
namespace SupaLidlGame.Characters; namespace SupaLidlGame.Characters;
@ -81,7 +80,7 @@ public partial class Doc : Boss
_dashState = StateMachine.FindChildOfType<CharacterDashState>(); _dashState = StateMachine.FindChildOfType<CharacterDashState>();
_originalDashModifier = _dashState.VelocityModifier; _originalDashModifier = _dashState.VelocityModifier;
var dialog = GD.Load<Resource>("res://Assets/Dialog/doc.dialogue"); var dialog = GD.Load<Resource>("res://Assets/Dialogue/doc.dialogue");
GetNode<BoundingBoxes.InteractionTrigger>("InteractionTrigger") GetNode<BoundingBoxes.InteractionTrigger>("InteractionTrigger")
.Interaction += () => .Interaction += () =>
@ -139,6 +138,7 @@ public partial class Doc : Boss
return 1; return 1;
} }
/*
public override void OnReceivedDamage( public override void OnReceivedDamage(
float damage, float damage,
Character inflictor, Character inflictor,
@ -150,6 +150,7 @@ public partial class Doc : Boss
base.OnReceivedDamage(damage, inflictor, knockback, knockbackDir); base.OnReceivedDamage(damage, inflictor, knockback, knockbackDir);
} }
*/
protected override void Think() protected override void Think()
{ {
@ -181,8 +182,12 @@ public partial class Doc : Boss
bool shouldDashAway = false; bool shouldDashAway = false;
bool shouldDashTowards = 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() float dot = Direction.Normalized()
.Dot(bestTarget.Direction.Normalized()); .Dot(bestTarget.Direction.Normalized());

View File

@ -726,6 +726,9 @@ stream = ExtResource("26_js7p2")
volume_db = 3.0 volume_db = 3.0
attenuation = 0.5 attenuation = 0.5
[node name="HurtSound" type="AudioStreamPlayer2D" parent="Effects"]
stream = ExtResource("9_stm0e")
[node name="Sprite" type="Sprite2D" parent="."] [node name="Sprite" type="Sprite2D" parent="."]
modulate = Color(1, 1, 1, 0.5) modulate = Color(1, 1, 1, 0.5)
y_sort_enabled = true y_sort_enabled = true
@ -753,16 +756,14 @@ script = ExtResource("8_r8ejq")
Items = Array[Node2D]([]) Items = Array[Node2D]([])
[node name="DocLance" parent="Inventory" instance=ExtResource("24_2es2r")] [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="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="InteractionTrigger" parent="." instance=ExtResource("33_08dyq")]
[node name="CollisionShape2D" parent="InteractionTrigger" index="0"] [node name="CollisionShape2D" parent="InteractionTrigger" index="0"]
position = Vector2(0, -8) position = Vector2(0, -6)
shape = SubResource("CircleShape2D_8hwat") shape = SubResource("CircleShape2D_8hwat")
[editable path="Hurtbox"] [editable path="Hurtbox"]

View File

@ -16,6 +16,44 @@ resource_local_to_scene = true
shader = ExtResource("1_fx1w5") shader = ExtResource("1_fx1w5")
shader_parameter/color = Quaternion(1, 1, 1, 1) shader_parameter/color = Quaternion(1, 1, 1, 1)
shader_parameter/intensity = 0.0 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"] [sub_resource type="AtlasTexture" id="AtlasTexture_55yt4"]
atlas = ExtResource("3_ocaae") atlas = ExtResource("3_ocaae")
@ -93,43 +131,6 @@ size = Vector2(16, 8)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_8lxmf"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_8lxmf"]
size = Vector2(16, 18) 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")] [node name="ExampleEnemy" type="CharacterBody2D" node_paths=PackedStringArray("Sprite", "Inventory", "StateMachine", "Hurtbox")]
y_sort_enabled = true y_sort_enabled = true
texture_filter = 3 texture_filter = 3
@ -159,6 +160,14 @@ script = ExtResource("6_73mr6")
IdleState = NodePath("../Idle") IdleState = NodePath("../Idle")
Character = NodePath("../..") 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="."] [node name="Sprite" type="AnimatedSprite2D" parent="."]
use_parent_material = true use_parent_material = true
position = Vector2(0, -4) position = Vector2(0, -4)
@ -184,11 +193,6 @@ script = ExtResource("7_43gq8")
[node name="Sword" parent="Inventory" instance=ExtResource("8_s3c8r")] [node name="Sword" parent="Inventory" instance=ExtResource("8_s3c8r")]
Knockback = 100.0 Knockback = 100.0
[node name="FlashAnimation" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_xe5eq")
}
[node name="HurtSound" type="AudioStreamPlayer2D" parent="."] [node name="HurtSound" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("10_n1e64") stream = ExtResource("10_n1e64")

View File

@ -1,4 +1,4 @@
#undef DEBUG_NPC #define DEBUG_NPC
using Godot; using Godot;
using SupaLidlGame.Extensions; 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 ShouldMove { get; set; } = true;
public bool CanAttack { get; set; } = true; public bool CanAttack { get; set; } = true;
@ -67,11 +70,16 @@ public partial class NPC : Character
{ {
base._Ready(); base._Ready();
Array.Fill(_weights, 0); Array.Fill(_weights, 0);
if (DefaultSelectedItem is not null)
{
Inventory.SelectedItem = DefaultSelectedItem;
}
} }
public override void _Draw() public override void _Draw()
{ {
#if DEBUG_NPC #if DEBUG
for (int i = 0; i < 16; i++) for (int i = 0; i < 16; i++)
{ {
Vector2 vec = _weightDirs[i] * _weights[i] * 32; Vector2 vec = _weightDirs[i] * _weights[i] * 32;
@ -92,7 +100,7 @@ public partial class NPC : Character
base._Draw(); base._Draw();
} }
protected virtual Character FindBestTarget() public virtual Character FindBestTarget()
{ {
float bestDist = float.MaxValue; float bestDist = float.MaxValue;
Character bestChar = null; Character bestChar = null;
@ -100,7 +108,8 @@ public partial class NPC : Character
{ {
if (node is Character character) if (node is Character character)
{ {
if (character.Faction == Faction || character.Health <= 0) bool isFriendly = character.Faction == Faction;
if (isFriendly || character.Health <= 0)
{ {
continue; continue;
} }

View File

@ -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="Script" path="res://Characters/Player.cs" id="1_flygr"]
[ext_resource type="Shader" path="res://Shaders/Flash.gdshader" id="2_ngsgt"] [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="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="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/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="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="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"] [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="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="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="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="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://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"] [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"] [sub_resource type="Animation" id="Animation_adxyh"]
resource_local_to_scene = true
length = 0.001 length = 0.001
tracks/0/type = "value" tracks/0/type = "value"
tracks/0/imported = false tracks/0/imported = false
@ -187,203 +190,6 @@ _data = {
"sword": SubResource("Animation_3w3u1") "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"] [sub_resource type="AnimationLibrary" id="AnimationLibrary_kks2p"]
_data = { _data = {
"stun": ExtResource("8_m08fh") "stun": ExtResource("8_m08fh")
@ -468,6 +274,10 @@ font_size = 24
[sub_resource type="RectangleShape2D" id="RectangleShape2D_cjk6b"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_cjk6b"]
size = Vector2(8, 8) 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")] [node name="Player" type="CharacterBody2D" node_paths=PackedStringArray("Camera", "DirectionMarker", "Sprite", "Inventory", "StateMachine", "Hurtbox")]
y_sort_enabled = true y_sort_enabled = true
texture_filter = 3 texture_filter = 3
@ -495,18 +305,27 @@ MoveState = NodePath("../Move")
IdleState = NodePath(".") IdleState = NodePath(".")
Character = 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") script = ExtResource("7_dfqd8")
RollState = NodePath("../Roll") RollState = NodePath("../Roll")
DashState = NodePath("../Dash")
IdleState = NodePath("../Idle") IdleState = NodePath("../Idle")
Character = NodePath("../..") 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")] [node name="Roll" type="Node" parent="StateMachine" node_paths=PackedStringArray("IdleState", "Character")]
script = ExtResource("8_fy0v5") script = ExtResource("8_fy0v5")
IdleState = NodePath("../Idle") IdleState = NodePath("../Idle")
Character = NodePath("../..") Character = NodePath("../..")
[node name="Animations" type="Node" parent="."] [node name="Animations" type="Node" parent="."]
unique_name_in_owner = true
script = ExtResource("7_sdgvb") script = ExtResource("7_sdgvb")
[node name="Movement" type="AnimationPlayer" parent="Animations"] [node name="Movement" type="AnimationPlayer" parent="Animations"]
@ -522,7 +341,7 @@ libraries = {
[node name="Hurt" type="AnimationPlayer" parent="Animations"] [node name="Hurt" type="AnimationPlayer" parent="Animations"]
root_node = NodePath("../..") root_node = NodePath("../..")
libraries = { libraries = {
"": SubResource("AnimationLibrary_xe5eq") "": ExtResource("9_g42dl")
} }
[node name="Stun" type="AnimationPlayer" parent="Animations"] [node name="Stun" type="AnimationPlayer" parent="Animations"]
@ -539,6 +358,7 @@ parameters/conditions/move = false
parameters/conditions/roll = false parameters/conditions/roll = false
[node name="Effects" type="Node2D" parent="."] [node name="Effects" type="Node2D" parent="."]
unique_name_in_owner = true
[node name="RollParticles" type="GPUParticles2D" parent="Effects"] [node name="RollParticles" type="GPUParticles2D" parent="Effects"]
emitting = false emitting = false
@ -574,14 +394,15 @@ volume_db = 2.0
[node name="Footstep" type="AudioStreamPlayer2D" parent="Effects"] [node name="Footstep" type="AudioStreamPlayer2D" parent="Effects"]
stream = ExtResource("13_bxguv") stream = ExtResource("13_bxguv")
[node name="HurtSound" type="AudioStreamPlayer2D" parent="Effects"]
stream = ExtResource("12_vvem5")
[node name="Camera2D" parent="." instance=ExtResource("4_ym125")] [node name="Camera2D" parent="." instance=ExtResource("4_ym125")]
limit_left = -256 limit_smoothed = true
limit_top = -256
limit_right = 256
limit_bottom = 256
position_smoothing_speed = 8.0 position_smoothing_speed = 8.0
[node name="Sprites" type="Node2D" parent="."] [node name="Sprites" type="Node2D" parent="."]
unique_name_in_owner = true
y_sort_enabled = true y_sort_enabled = true
use_parent_material = true use_parent_material = true
rotation = 6.28319 rotation = 6.28319
@ -641,11 +462,6 @@ shape = SubResource("RectangleShape2D_cjk6b")
[node name="Timer" type="Timer" parent="Hurtbox"] [node name="Timer" type="Timer" parent="Hurtbox"]
one_shot = true 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="."] [node name="AudioListener2D" type="AudioListener2D" parent="."]
visible = false visible = false
current = true current = true
@ -655,7 +471,6 @@ visible = false
position = Vector2(0, 6) position = Vector2(0, 6)
[node name="InteractionRay" type="RayCast2D" parent="Direction2D"] [node name="InteractionRay" type="RayCast2D" parent="Direction2D"]
visible = false
target_position = Vector2(16, 0) target_position = Vector2(16, 0)
collision_mask = 64 collision_mask = 64
collide_with_areas = true collide_with_areas = true
@ -663,6 +478,7 @@ script = ExtResource("13_hs3u1")
[node name="PointLight2D" type="PointLight2D" parent="."] [node name="PointLight2D" type="PointLight2D" parent="."]
visible = false visible = false
position = Vector2(0, -8)
blend_mode = 2 blend_mode = 2
shadow_enabled = true shadow_enabled = true
shadow_filter = 2 shadow_filter = 2
@ -673,4 +489,8 @@ height = 10.0
[node name="DamageTime" type="Node" parent="."] [node name="DamageTime" type="Node" parent="."]
script = ExtResource("15_4xl06") script = ExtResource("15_4xl06")
[node name="LightOccluder2D" type="LightOccluder2D" parent="."]
occluder = SubResource("OccluderPolygon2D_7482j")
occluder_light_mask = 8
[editable path="Hurtbox"] [editable path="Hurtbox"]

View File

@ -1,7 +1,7 @@
[gd_scene load_steps=11 format=3 uid="uid://c1w7t6irnohfx"] [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://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"] [sub_resource type="AtlasTexture" id="AtlasTexture_js1l1"]
atlas = ExtResource("1_14bgb") atlas = ExtResource("1_14bgb")
@ -64,15 +64,16 @@ animations = [{
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
texture_filter = 1 texture_filter = 1
position = Vector2(0, -12) position = Vector2(0, -10)
sprite_frames = SubResource("SpriteFrames_gf7ku") sprite_frames = SubResource("SpriteFrames_gf7ku")
autoplay = "default" autoplay = "default"
frame_progress = 0.337799 frame_progress = 0.337799
[node name="PointLight2D" type="PointLight2D" parent="."] [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 blend_mode = 2
shadow_enabled = true shadow_enabled = true
shadow_filter_smooth = 3.0 shadow_filter_smooth = 3.0
texture = ExtResource("2_f0xs8") texture = ExtResource("2_hotvd")
offset = Vector2(0, 2) offset = Vector2(0, 2)
texture_scale = 0.25

View File

@ -107,7 +107,7 @@ frame_progress = 0.743234
offset = Vector2(0, -12) offset = Vector2(0, -12)
[node name="PointLight2D" type="PointLight2D" parent="."] [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 energy = 1.2
blend_mode = 2 blend_mode = 2
shadow_filter_smooth = 3.0 shadow_filter_smooth = 3.0

View File

@ -1,12 +1,11 @@
using Godot; using Godot;
using SupaLidlGame.Extensions;
namespace SupaLidlGame.Entities; namespace SupaLidlGame.Entities;
public partial class UnwantedFrequency : Projectile public partial class UnwantedFrequency : Projectile, Utils.ITarget
{ {
[Export] [Export]
public Characters.Character Homing { get; set; } public Characters.Character CharacterTarget { get; set; }
[Export] [Export]
public float HomingVelocity { get; set; } = 1; public float HomingVelocity { get; set; } = 1;
@ -46,17 +45,10 @@ public partial class UnwantedFrequency : Projectile
TrailRotation.Rotation = Direction.Angle(); TrailRotation.Rotation = Direction.Angle();
TrailPosition.Position = new Vector2(0, 4 * Mathf.Sin(radians)); TrailPosition.Position = new Vector2(0, 4 * Mathf.Sin(radians));
// home towards player if (CharacterTarget is not null)
if (Homing is not null)
{ {
var desired = GlobalPosition.DirectionTo(Homing.GlobalPosition); var pos = CharacterTarget.GlobalPosition;
//var steer = (desired - Direction) * HomingVelocity * (float)delta; var desired = GlobalPosition.DirectionTo(pos);
//float dTheta = Direction.AngleTo(dirToHoming);
//float dTheta = Mathf.Acos(Direction.Dot(dirToHoming));
//float max = (float)(delta * HomingRotationalVelocity);
//float rotVel = Mathf.Clamp(dTheta, -max, max);
Direction += (desired - Direction) * HomingVelocity * (float)delta; Direction += (desired - Direction) * HomingVelocity * (float)delta;
} }

View File

@ -353,13 +353,12 @@ graph_offset = Vector2(0, -104.073)
[sub_resource type="AnimationNodeStateMachinePlayback" id="AnimationNodeStateMachinePlayback_o5g2u"] [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 y_sort_enabled = true
texture_filter = 3 texture_filter = 3
script = ExtResource("1_mlo73") script = ExtResource("1_mlo73")
Hitbox = NodePath("Hitbox") Hitbox = NodePath("Hitbox")
AnimationPlayer = NodePath("AnimationPlayer") AnimationPlayer = NodePath("AnimationPlayer")
AnimationTree = NodePath("AnimationTree")
AttackTime = 0.2 AttackTime = 0.2
AttackAnimationDuration = 0.75 AttackAnimationDuration = 0.75
ParryParticles = NodePath("Anchor/Node2D/Sprite2D/ParryParticles") ParryParticles = NodePath("Anchor/Node2D/Sprite2D/ParryParticles")
@ -386,10 +385,9 @@ script = ExtResource("4_j3cud")
Sword = NodePath("../..") Sword = NodePath("../..")
AttackState = NodePath("../Attack") 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") script = ExtResource("5_hmisb")
Sword = NodePath("../..") Sword = NodePath("../..")
AnticipateState = NodePath("../Anticipate")
IdleState = NodePath("../Idle") IdleState = NodePath("../Idle")
[node name="WorldEnvironment" type="WorldEnvironment" parent="."] [node name="WorldEnvironment" type="WorldEnvironment" parent="."]
@ -461,10 +459,8 @@ hframes = 5
[node name="SwingSound" type="AudioStreamPlayer2D" parent="."] [node name="SwingSound" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("10_mfnl7") stream = ExtResource("10_mfnl7")
max_distance = 256.0
[node name="ParrySound" type="AudioStreamPlayer2D" parent="."] [node name="ParrySound" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("6_8nxjm") stream = ExtResource("6_8nxjm")
max_distance = 256.0
[editable path="Hitbox"] [editable path="Hitbox"]

View File

@ -1837,30 +1837,30 @@ y_sort_enabled = true
texture_filter = 3 texture_filter = 3
tile_set = SubResource("TileSet_18c7j") tile_set = SubResource("TileSet_18c7j")
format = 2 format = 2
layer_0/name = "Walls" layer_0/name = "Layer 3"
layer_0/y_sort_enabled = true layer_0/y_sort_enabled = true
layer_1/name = "Ground 2" layer_1/name = "Layer 2"
layer_1/enabled = true layer_1/enabled = true
layer_1/modulate = Color(1, 1, 1, 1) layer_1/modulate = Color(1, 1, 1, 1)
layer_1/y_sort_enabled = true layer_1/y_sort_enabled = true
layer_1/y_sort_origin = 0 layer_1/y_sort_origin = 0
layer_1/z_index = -1 layer_1/z_index = -1
layer_1/tile_data = PackedInt32Array() layer_1/tile_data = PackedInt32Array()
layer_2/name = "Ground Paths" layer_2/name = "Layer 1 Overlay"
layer_2/enabled = true layer_2/enabled = true
layer_2/modulate = Color(1, 1, 1, 1) layer_2/modulate = Color(1, 1, 1, 1)
layer_2/y_sort_enabled = true layer_2/y_sort_enabled = true
layer_2/y_sort_origin = 0 layer_2/y_sort_origin = 0
layer_2/z_index = -1 layer_2/z_index = -1
layer_2/tile_data = PackedInt32Array() layer_2/tile_data = PackedInt32Array()
layer_3/name = "Ground" layer_3/name = "Layer 1"
layer_3/enabled = true layer_3/enabled = true
layer_3/modulate = Color(1, 1, 1, 1) layer_3/modulate = Color(1, 1, 1, 1)
layer_3/y_sort_enabled = true layer_3/y_sort_enabled = true
layer_3/y_sort_origin = 0 layer_3/y_sort_origin = 0
layer_3/z_index = -2 layer_3/z_index = -2
layer_3/tile_data = PackedInt32Array() layer_3/tile_data = PackedInt32Array()
layer_4/name = "Lower 2" layer_4/name = "Layer 0"
layer_4/enabled = true layer_4/enabled = true
layer_4/modulate = Color(1, 1, 1, 1) layer_4/modulate = Color(1, 1, 1, 1)
layer_4/y_sort_enabled = true layer_4/y_sort_enabled = true
@ -1881,6 +1881,8 @@ Spawners = NodePath("Spawners")
[node name="CanvasModulate" type="CanvasModulate" parent="."] [node name="CanvasModulate" type="CanvasModulate" parent="."]
[node name="Static" type="Node2D" parent="."]
[node name="Entities" type="Node2D" parent="."] [node name="Entities" type="Node2D" parent="."]
y_sort_enabled = true y_sort_enabled = true

View File

@ -1,7 +1,7 @@
[gd_scene load_steps=7 format=3 uid="uid://1pb3mpmrl7lc"] [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="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="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="Script" path="res://UI/UIController.cs" id="3_fe62s"]
[ext_resource type="PackedScene" uid="uid://01d24ij5av1y" path="res://UI/BossBar.tscn" id="5_8njq4"] [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")] [node name="World" type="Node2D" node_paths=PackedStringArray("UIController", "MusicPlayer", "DialogueBalloon")]
script = ExtResource("1_1k6ew") script = ExtResource("1_1k6ew")
StartingArea = ExtResource("2_avsrq") StartingArea = ExtResource("2_lddbd")
UIController = NodePath("CanvasLayer/UI") UIController = NodePath("CanvasLayer/UI")
MusicPlayer = NodePath("MusicPlayer") MusicPlayer = NodePath("MusicPlayer")
DialogueBalloon = NodePath("DialogBalloon") DialogueBalloon = NodePath("DialogBalloon")

View File

@ -19,6 +19,15 @@ public partial class Map : TileMap
[Export] [Export]
public Vector2 CameraUpperBound { get; set; } 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; private bool _active;
public bool Active public bool Active
@ -44,6 +53,11 @@ public partial class Map : TileMap
base._Process(delta); base._Process(delta);
} }
public void Load()
{
Godot.RenderingServer.SetDefaultClearColor(ClearColor);
}
public Node SpawnEntity(PackedScene scene) public Node SpawnEntity(PackedScene scene)
{ {
var instance = scene.Instantiate(); var instance = scene.Instantiate();

View File

@ -46,7 +46,7 @@ public abstract partial class CharacterState : Node, IState<CharacterState>
public virtual CharacterState PhysicsProcess(double delta) public virtual CharacterState PhysicsProcess(double delta)
{ {
if (Character.Health < 0) if (!Character.IsAlive)
{ {
Character.Velocity = Vector2.Zero; Character.Velocity = Vector2.Zero;
Character.MoveAndSlide(); Character.MoveAndSlide();

View File

@ -7,6 +7,9 @@ public partial class PlayerMoveState : PlayerState
[Export] [Export]
public PlayerRollState RollState { get; set; } public PlayerRollState RollState { get; set; }
[Export]
public CharacterDashState DashState { get; set; }
public double MoveDuration { get; private set; } public double MoveDuration { get; private set; }
public override IState<CharacterState> Enter(IState<CharacterState> previousState) public override IState<CharacterState> Enter(IState<CharacterState> previousState)

View File

@ -41,7 +41,7 @@ public partial class DocShungiteDartState : DocAttackState
protected override void Attack() protected override void Attack()
{ {
var player = _world.CurrentPlayer; var player = NPC.FindBestTarget();
var playerPos = player.GlobalPosition; var playerPos = player.GlobalPosition;
// global position is (from npc to player) * 2 = (2 * npc) - player // global position is (from npc to player) * 2 = (2 * npc) - player
//projectile.GlobalPosition = 2 * NPC.GlobalPosition - playerPos; //projectile.GlobalPosition = 2 * NPC.GlobalPosition - playerPos;

View File

@ -48,7 +48,7 @@ public partial class DocShungiteSpikeState : DocShungiteDartState
protected override void Attack() protected override void Attack()
{ {
var player = _world.CurrentPlayer; var player = NPC.FindBestTarget();
var playerPos = player.GlobalPosition; var playerPos = player.GlobalPosition;
var docPos = NPC.GlobalPosition; var docPos = NPC.GlobalPosition;
var projectile = SpawnProjectile(docPos, Vector2.Zero) as ShungiteSpike; var projectile = SpawnProjectile(docPos, Vector2.Zero) as ShungiteSpike;

View File

@ -38,7 +38,7 @@ public partial class DocUnwantedFrequencyState : DocShungiteSpikeState
var docPos = NPC.GlobalPosition; var docPos = NPC.GlobalPosition;
var projectile = SpawnProjectile(docPos, docPos.DirectionTo(playerPos)) var projectile = SpawnProjectile(docPos, docPos.DirectionTo(playerPos))
as UnwantedFrequency; as UnwantedFrequency;
projectile.Homing = player; projectile.CharacterTarget = NPC.FindBestTarget();
_currentAttackDuration = 1; _currentAttackDuration = 1;
_currentAttacks++; _currentAttacks++;

6
Utils/ITarget.cs 100644
View File

@ -0,0 +1,6 @@
namespace SupaLidlGame.Utils;
public interface ITarget
{
public Characters.Character CharacterTarget { get; set; }
}

View File

@ -121,6 +121,7 @@ public partial class World : Node2D
CurrentMap = map; CurrentMap = map;
CurrentMap.Active = true; CurrentMap.Active = true;
CurrentMap.Load();
if (CurrentPlayer is not null) if (CurrentPlayer is not null)
{ {

View File

@ -1,3 +1,21 @@
[gd_resource type="AudioBusLayout" format=3 uid="uid://ljp6denwxmye"] [gd_resource type="AudioBusLayout" format=3 uid="uid://ljp6denwxmye"]
[resource] [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"

View File

@ -24,6 +24,7 @@ GlobalState="*res://State/Global/GlobalState.cs"
[dialogue_manager] [dialogue_manager]
general/states=["GlobalState"] general/states=["GlobalState"]
general/wrap_lines=true
[display] [display]
@ -105,10 +106,11 @@ equip_3={
[internationalization] [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] [layer_names]
2d_render/layer_4="Godray Occluder"
2d_physics/layer_1="World" 2d_physics/layer_1="World"
2d_physics/layer_2="Character" 2d_physics/layer_2="Character"
2d_physics/layer_3="Player" 2d_physics/layer_3="Player"
@ -123,4 +125,5 @@ locale/translations_pot_files=PackedStringArray("res://Assets/Dialog/doc.dialogu
[rendering] [rendering]
textures/canvas_textures/default_texture_filter=0
environment/defaults/default_clear_color=Color(0.301961, 0.301961, 0.301961, 1) environment/defaults/default_clear_color=Color(0.301961, 0.301961, 0.301961, 1)