commit
448fad0d72
Binary file not shown.
|
@ -0,0 +1,19 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="oggvorbisstr"
|
||||||
|
type="AudioStreamOggVorbis"
|
||||||
|
uid="uid://bkeyg8weaqnuu"
|
||||||
|
path="res://.godot/imported/splat-player.ogg-b9195de7bb7ca34678fd41a9159d6c3d.oggvorbisstr"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Assets/Sounds/splat-player.ogg"
|
||||||
|
dest_files=["res://.godot/imported/splat-player.ogg-b9195de7bb7ca34678fd41a9159d6c3d.oggvorbisstr"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
loop=false
|
||||||
|
loop_offset=0
|
||||||
|
bpm=0
|
||||||
|
beat_count=0
|
||||||
|
bar_beats=4
|
Binary file not shown.
|
@ -0,0 +1,19 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="oggvorbisstr"
|
||||||
|
type="AudioStreamOggVorbis"
|
||||||
|
uid="uid://k6kpdj1kv0jg"
|
||||||
|
path="res://.godot/imported/splat.ogg-3afac4e48ba675494c2bad9f16c4bde8.oggvorbisstr"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Assets/Sounds/splat.ogg"
|
||||||
|
dest_files=["res://.godot/imported/splat.ogg-3afac4e48ba675494c2bad9f16c4bde8.oggvorbisstr"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
loop=false
|
||||||
|
loop_offset=0
|
||||||
|
bpm=0
|
||||||
|
beat_count=0
|
||||||
|
bar_beats=4
|
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 536 B |
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://baiuqgrqipppt"
|
||||||
|
path="res://.godot/imported/doc.png-044b4c8c4ee17602696518fdf8def758.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Assets/Sprites/Characters/doc.png"
|
||||||
|
dest_files=["res://.godot/imported/doc.png-044b4c8c4ee17602696518fdf8def758.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 296 B |
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://debqunpkdemj2"
|
||||||
|
path="res://.godot/imported/mini-shungite.png-01bdbec41fe54ed8fc826d4314ec257e.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Assets/Sprites/Misc/mini-shungite.png"
|
||||||
|
dest_files=["res://.godot/imported/mini-shungite.png-01bdbec41fe54ed8fc826d4314ec257e.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 458 B |
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dvx2b0y6dup53"
|
||||||
|
path="res://.godot/imported/shungite-spike.png-3c88db04670aa56f0aed81fe7332990b.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Assets/Sprites/Misc/shungite-spike.png"
|
||||||
|
dest_files=["res://.godot/imported/shungite-spike.png-3c88db04670aa56f0aed81fe7332990b.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 414 B |
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dmeqjcc3uu4xi"
|
||||||
|
path="res://.godot/imported/shungite.png-b3a7d7db0635944f7318920460aea95b.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Assets/Sprites/Misc/shungite.png"
|
||||||
|
dest_files=["res://.godot/imported/shungite.png-b3a7d7db0635944f7318920460aea95b.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://5k0o7d7j65a4"
|
||||||
|
path="res://.godot/imported/arena-tileset-normal.png-9466546ce6c631f7ed3196f7d2a888b3.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Assets/Sprites/arena-tileset-normal.png"
|
||||||
|
dest_files=["res://.godot/imported/arena-tileset-normal.png-9466546ce6c631f7ed3196f7d2a888b3.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://b0yiy7w8nxmas"
|
||||||
|
path="res://.godot/imported/arena-tileset.png-a3c9cd5d13a16cc6a35727d6d51ff6f7.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Assets/Sprites/arena-tileset.png"
|
||||||
|
dest_files=["res://.godot/imported/arena-tileset.png-a3c9cd5d13a16cc6a35727d6d51ff6f7.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
|
@ -0,0 +1,54 @@
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace SupaLidlGame.BoundingBoxes;
|
||||||
|
|
||||||
|
public partial class InteractionRay : RayCast2D
|
||||||
|
{
|
||||||
|
private InteractionTrigger _trigger;
|
||||||
|
|
||||||
|
public InteractionTrigger Trigger
|
||||||
|
{
|
||||||
|
get => _trigger;
|
||||||
|
protected set
|
||||||
|
{
|
||||||
|
if (_trigger != value)
|
||||||
|
{
|
||||||
|
EmitSignal(SignalName.TriggerHit, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_trigger is not null)
|
||||||
|
{
|
||||||
|
LastValidTrigger = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
_trigger = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public InteractionTrigger LastValidTrigger { get; set; }
|
||||||
|
|
||||||
|
[Signal]
|
||||||
|
public delegate void TriggerHitEventHandler(InteractionTrigger trigger);
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void _PhysicsProcess(double delta)
|
||||||
|
{
|
||||||
|
if (IsColliding())
|
||||||
|
{
|
||||||
|
var obj = GetCollider();
|
||||||
|
// if obj is an InteractionTrigger then we signal hit
|
||||||
|
if (obj is InteractionTrigger trigger)
|
||||||
|
{
|
||||||
|
Trigger = trigger;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Trigger = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
using Godot;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace SupaLidlGame.BoundingBoxes;
|
||||||
|
|
||||||
|
public partial class InteractionReceiver : Area2D
|
||||||
|
{
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
[gd_scene load_steps=3 format=3 uid="uid://cdxiutj5jdnvo"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://BoundingBoxes/InteractionReceiver.cs" id="1_y2pab"]
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_vcbnn"]
|
||||||
|
radius = 16.0
|
||||||
|
|
||||||
|
[node name="InteractionReceiver" type="Area2D"]
|
||||||
|
collision_layer = 32
|
||||||
|
collision_mask = 64
|
||||||
|
script = ExtResource("1_y2pab")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("CircleShape2D_vcbnn")
|
||||||
|
debug_color = Color(0.792157, 0.0705882, 1, 0.419608)
|
||||||
|
|
||||||
|
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
||||||
|
[connection signal="area_exited" from="." to="." method="_on_area_exited"]
|
|
@ -0,0 +1,24 @@
|
||||||
|
using Godot;
|
||||||
|
using SupaLidlGame.Characters;
|
||||||
|
|
||||||
|
namespace SupaLidlGame.BoundingBoxes;
|
||||||
|
|
||||||
|
public partial class InteractionTrigger : Area2D
|
||||||
|
{
|
||||||
|
[Signal]
|
||||||
|
public delegate void InteractionEventHandler();
|
||||||
|
|
||||||
|
[Signal]
|
||||||
|
public delegate void TargetEventHandler();
|
||||||
|
|
||||||
|
[Signal]
|
||||||
|
public delegate void UntargetEventHandler();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Invokes or triggers an interaction to occur.
|
||||||
|
/// </summary>
|
||||||
|
public void InvokeInteraction()
|
||||||
|
{
|
||||||
|
EmitSignal(SignalName.Interaction);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
[gd_scene load_steps=3 format=3 uid="uid://dldnp8eunxj3q"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://BoundingBoxes/InteractionTrigger.cs" id="1_uoemj"]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_dfj3a"]
|
||||||
|
|
||||||
|
[node name="InteractionTrigger" type="Area2D"]
|
||||||
|
collision_layer = 64
|
||||||
|
collision_mask = 0
|
||||||
|
script = ExtResource("1_uoemj")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("RectangleShape2D_dfj3a")
|
||||||
|
debug_color = Color(0.905882, 0, 0.745098, 0.419608)
|
|
@ -1,4 +1,5 @@
|
||||||
using Godot;
|
using Godot;
|
||||||
|
using GodotUtilities;
|
||||||
using SupaLidlGame.Extensions;
|
using SupaLidlGame.Extensions;
|
||||||
using SupaLidlGame.Items;
|
using SupaLidlGame.Items;
|
||||||
using SupaLidlGame.Utils;
|
using SupaLidlGame.Utils;
|
||||||
|
@ -25,6 +26,12 @@ public partial class Character : CharacterBody2D, IFaction
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Signal]
|
||||||
|
public delegate void HurtEventHandler(Events.HealthChangedArgs args);
|
||||||
|
|
||||||
|
[Signal]
|
||||||
|
public delegate void DeathEventHandler(Events.HealthChangedArgs args);
|
||||||
|
|
||||||
protected float _mass = 1.0f;
|
protected float _mass = 1.0f;
|
||||||
|
|
||||||
public Vector2 NetImpulse { get; set; } = Vector2.Zero;
|
public Vector2 NetImpulse { get; set; } = Vector2.Zero;
|
||||||
|
@ -67,9 +74,17 @@ public partial class Character : CharacterBody2D, IFaction
|
||||||
[Export]
|
[Export]
|
||||||
public CharacterStateMachine StateMachine { get; set; }
|
public CharacterStateMachine StateMachine { get; set; }
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public BoundingBoxes.Hurtbox Hurtbox { get; set; }
|
||||||
|
|
||||||
[Export]
|
[Export]
|
||||||
public ushort Faction { get; set; }
|
public ushort Faction { get; set; }
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
Hurtbox.ReceivedDamage += OnReceivedDamage;
|
||||||
|
}
|
||||||
|
|
||||||
public override void _Process(double delta)
|
public override void _Process(double delta)
|
||||||
{
|
{
|
||||||
if (StateMachine != null)
|
if (StateMachine != null)
|
||||||
|
@ -81,14 +96,6 @@ public partial class Character : CharacterBody2D, IFaction
|
||||||
DrawTarget();
|
DrawTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void _Input(InputEvent @event)
|
|
||||||
{
|
|
||||||
if (StateMachine != null)
|
|
||||||
{
|
|
||||||
StateMachine.Input(@event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void _PhysicsProcess(double delta)
|
public override void _PhysicsProcess(double delta)
|
||||||
{
|
{
|
||||||
if (StateMachine != null)
|
if (StateMachine != null)
|
||||||
|
@ -127,7 +134,7 @@ public partial class Character : CharacterBody2D, IFaction
|
||||||
StunTime += time;
|
StunTime += time;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void DrawTarget()
|
protected virtual void DrawTarget()
|
||||||
{
|
{
|
||||||
Vector2 target = Target;
|
Vector2 target = Target;
|
||||||
float angle = Mathf.Atan2(target.Y, Mathf.Abs(target.X));
|
float angle = Mathf.Atan2(target.Y, Mathf.Abs(target.X));
|
||||||
|
@ -167,13 +174,19 @@ public partial class Character : CharacterBody2D, IFaction
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void _on_hurtbox_received_damage(
|
public virtual void OnReceivedDamage(
|
||||||
float damage,
|
float damage,
|
||||||
Character inflictor,
|
Character inflictor,
|
||||||
float knockback,
|
float knockback,
|
||||||
Vector2 knockbackOrigin = default,
|
Vector2 knockbackOrigin = default,
|
||||||
Vector2 knockbackVector = default)
|
Vector2 knockbackVector = default)
|
||||||
{
|
{
|
||||||
|
if (Health <= 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
float oldHealth = Health;
|
||||||
Health -= damage;
|
Health -= damage;
|
||||||
|
|
||||||
// create damage text
|
// create damage text
|
||||||
|
@ -189,7 +202,14 @@ public partial class Character : CharacterBody2D, IFaction
|
||||||
{
|
{
|
||||||
if (knockbackOrigin == default)
|
if (knockbackOrigin == default)
|
||||||
{
|
{
|
||||||
knockbackOrigin = inflictor.GlobalPosition;
|
if (inflictor is null)
|
||||||
|
{
|
||||||
|
knockbackOrigin = GlobalPosition + Vector2.Down;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
knockbackOrigin = inflictor.GlobalPosition;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
knockbackDir = knockbackOrigin.DirectionTo(GlobalPosition);
|
knockbackDir = knockbackOrigin.DirectionTo(GlobalPosition);
|
||||||
|
@ -217,7 +237,25 @@ public partial class Character : CharacterBody2D, IFaction
|
||||||
if (this.GetNode("HurtSound") is AudioStreamPlayer2D sound)
|
if (this.GetNode("HurtSound") is AudioStreamPlayer2D sound)
|
||||||
{
|
{
|
||||||
// very small pitch deviation
|
// very small pitch deviation
|
||||||
sound.At(GlobalPosition).WithPitchDeviation(0.125f).Play();
|
sound.At(GlobalPosition).WithPitchDeviation(0.125f).PlayOneShot();
|
||||||
|
}
|
||||||
|
|
||||||
|
Events.HealthChangedArgs args = new Events.HealthChangedArgs
|
||||||
|
{
|
||||||
|
Attacker = inflictor,
|
||||||
|
OldHealth = oldHealth,
|
||||||
|
NewHealth = Health,
|
||||||
|
Damage = damage,
|
||||||
|
};
|
||||||
|
|
||||||
|
EmitSignal(SignalName.Hurt, args);
|
||||||
|
|
||||||
|
if (Health <= 0)
|
||||||
|
{
|
||||||
|
EmitSignal(SignalName.Death, args);
|
||||||
|
GetNode<GpuParticles2D>("DeathParticles")
|
||||||
|
.CloneOnWorld<GpuParticles2D>()
|
||||||
|
.EmitOneShot();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace SupaLidlGame.Characters;
|
||||||
|
|
||||||
|
public partial class Doc : Enemy
|
||||||
|
{
|
||||||
|
[Export]
|
||||||
|
public State.NPC.NPCStateMachine BossStateMachine { get; set; }
|
||||||
|
|
||||||
|
public int Intensity
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
switch (Health)
|
||||||
|
{
|
||||||
|
case < 250:
|
||||||
|
return 3;
|
||||||
|
case < 500:
|
||||||
|
return 2;
|
||||||
|
default:
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
GD.Print(Health);
|
||||||
|
base._Ready();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void _Process(double delta)
|
||||||
|
{
|
||||||
|
BossStateMachine.Process(delta);
|
||||||
|
base._Process(delta);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,316 @@
|
||||||
|
[gd_scene load_steps=36 format=3 uid="uid://d2skjvvx6fal0"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://Characters/Doc.cs" id="2_3elet"]
|
||||||
|
[ext_resource type="Shader" path="res://Shaders/Flash.gdshader" id="2_5jxom"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://baiuqgrqipppt" path="res://Assets/Sprites/Characters/doc.png" id="3_rs44f"]
|
||||||
|
[ext_resource type="Script" path="res://State/Character/CharacterStateMachine.cs" id="3_t5jjc"]
|
||||||
|
[ext_resource type="Script" path="res://State/Character/NPCIdleState.cs" id="4_b35px"]
|
||||||
|
[ext_resource type="Script" path="res://State/Character/NPCMoveState.cs" id="5_pejsd"]
|
||||||
|
[ext_resource type="Script" path="res://State/NPC/NPCStateMachine.cs" id="6_kjpug"]
|
||||||
|
[ext_resource type="Script" path="res://State/NPC/Doc/DocTelegraphState.cs" id="7_tfwbh"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://cjgxyhgcyvsv7" path="res://BoundingBoxes/Hurtbox.tscn" id="7_tnve0"]
|
||||||
|
[ext_resource type="Script" path="res://State/NPC/Doc/DocShungiteDartState.cs" id="8_1hoax"]
|
||||||
|
[ext_resource type="Script" path="res://Items/Inventory.cs" id="8_r8ejq"]
|
||||||
|
[ext_resource type="Script" path="res://State/NPC/Doc/DocExitState.cs" id="9_6com1"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://1tiswf3gtyvv" path="res://Entities/ShungiteSpike.tscn" id="9_7kavk"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://djaljmco3xo4g" path="res://Entities/ShungiteDart.tscn" id="9_kthpr"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://k6kpdj1kv0jg" path="res://Assets/Sounds/splat.ogg" id="9_stm0e"]
|
||||||
|
[ext_resource type="Script" path="res://State/NPC/Doc/DocShungiteSpikeState.cs" id="10_bgs6o"]
|
||||||
|
[ext_resource type="Script" path="res://State/NPC/Doc/DocChooseAttackState.cs" id="12_45x13"]
|
||||||
|
|
||||||
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_7n7iy"]
|
||||||
|
resource_local_to_scene = true
|
||||||
|
shader = ExtResource("2_5jxom")
|
||||||
|
shader_parameter/color = Quaternion(1, 1, 1, 1)
|
||||||
|
shader_parameter/intensity = 0.0
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_7oukw"]
|
||||||
|
resource_name = "enter_in"
|
||||||
|
length = 0.5
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("../Sprite:scale")
|
||||||
|
tracks/0/interp = 2
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.4),
|
||||||
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(2, 0.5), Vector2(1, 1)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("../Sprite:modulate")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.5),
|
||||||
|
"transitions": PackedFloat32Array(2, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 0.5)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_j3s0y"]
|
||||||
|
resource_name = "exit_out"
|
||||||
|
length = 0.5
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("../Sprite:scale")
|
||||||
|
tracks/0/interp = 2
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.4),
|
||||||
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(1, 1), Vector2(2, 0.5)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("../Sprite:modulate")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.5),
|
||||||
|
"transitions": PackedFloat32Array(1, 2),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Color(1, 1, 1, 0.5), Color(1, 1, 1, 0)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_rpply"]
|
||||||
|
_data = {
|
||||||
|
"enter_in": SubResource("Animation_7oukw"),
|
||||||
|
"exit_out": SubResource("Animation_j3s0y")
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_dib6t"]
|
||||||
|
atlas = ExtResource("3_rs44f")
|
||||||
|
region = Rect2(0, 0, 12, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_cwqre"]
|
||||||
|
atlas = ExtResource("3_rs44f")
|
||||||
|
region = Rect2(12, 0, 12, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_r8xjl"]
|
||||||
|
atlas = ExtResource("3_rs44f")
|
||||||
|
region = Rect2(24, 0, 12, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_7hkj4"]
|
||||||
|
atlas = ExtResource("3_rs44f")
|
||||||
|
region = Rect2(36, 0, 12, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_w04w0"]
|
||||||
|
atlas = ExtResource("3_rs44f")
|
||||||
|
region = Rect2(48, 0, 12, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_ym6tg"]
|
||||||
|
atlas = ExtResource("3_rs44f")
|
||||||
|
region = Rect2(60, 0, 12, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_3rbas"]
|
||||||
|
atlas = ExtResource("3_rs44f")
|
||||||
|
region = Rect2(72, 0, 12, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_63wkp"]
|
||||||
|
atlas = ExtResource("3_rs44f")
|
||||||
|
region = Rect2(84, 0, 12, 16)
|
||||||
|
|
||||||
|
[sub_resource type="SpriteFrames" id="SpriteFrames_kb0pl"]
|
||||||
|
resource_local_to_scene = true
|
||||||
|
animations = [{
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_dib6t")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_cwqre")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"idle",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_r8xjl")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_7hkj4")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_w04w0")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_ym6tg")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_3rbas")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_63wkp")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"move",
|
||||||
|
"speed": 12.0
|
||||||
|
}]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_uict5"]
|
||||||
|
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="Doc" type="CharacterBody2D" node_paths=PackedStringArray("BossStateMachine", "Sprite", "Inventory", "StateMachine", "Hurtbox")]
|
||||||
|
y_sort_enabled = true
|
||||||
|
texture_filter = 3
|
||||||
|
material = SubResource("ShaderMaterial_7n7iy")
|
||||||
|
collision_layer = 10
|
||||||
|
collision_mask = 17
|
||||||
|
script = ExtResource("2_3elet")
|
||||||
|
BossStateMachine = NodePath("BossStateMachine")
|
||||||
|
Health = 1000.0
|
||||||
|
Sprite = NodePath("Sprite")
|
||||||
|
Inventory = NodePath("Inventory")
|
||||||
|
StateMachine = NodePath("StateMachine")
|
||||||
|
Hurtbox = NodePath("Hurtbox")
|
||||||
|
Faction = 2
|
||||||
|
|
||||||
|
[node name="StateMachine" type="Node" parent="." node_paths=PackedStringArray("InitialState", "Character")]
|
||||||
|
script = ExtResource("3_t5jjc")
|
||||||
|
InitialState = NodePath("Idle")
|
||||||
|
Character = NodePath("..")
|
||||||
|
|
||||||
|
[node name="Idle" type="Node" parent="StateMachine" node_paths=PackedStringArray("MoveState", "Character")]
|
||||||
|
script = ExtResource("4_b35px")
|
||||||
|
MoveState = NodePath("../Move")
|
||||||
|
Character = NodePath("../..")
|
||||||
|
|
||||||
|
[node name="Move" type="Node" parent="StateMachine" node_paths=PackedStringArray("IdleState", "Character")]
|
||||||
|
script = ExtResource("5_pejsd")
|
||||||
|
IdleState = NodePath("../Idle")
|
||||||
|
Character = NodePath("../..")
|
||||||
|
|
||||||
|
[node name="BossStateMachine" type="Node" parent="." node_paths=PackedStringArray("InitialState")]
|
||||||
|
script = ExtResource("6_kjpug")
|
||||||
|
InitialState = NodePath("Telegraph")
|
||||||
|
|
||||||
|
[node name="Telegraph" type="Node" parent="BossStateMachine" node_paths=PackedStringArray("TelegraphAnimationPlayer", "AttackState", "NPC")]
|
||||||
|
script = ExtResource("7_tfwbh")
|
||||||
|
TelegraphAnimationPlayer = NodePath("../../Animations/Telegraph")
|
||||||
|
AttackState = NodePath("../ChooseAttack")
|
||||||
|
NPC = NodePath("../..")
|
||||||
|
|
||||||
|
[node name="Dart" type="Node" parent="BossStateMachine" node_paths=PackedStringArray("ChooseAttackState", "Doc", "NPC")]
|
||||||
|
script = ExtResource("8_1hoax")
|
||||||
|
Duration = 8.0
|
||||||
|
AttackDuration = 1.0
|
||||||
|
Projectile = ExtResource("9_kthpr")
|
||||||
|
ChooseAttackState = NodePath("../ChooseAttack")
|
||||||
|
Doc = NodePath("../..")
|
||||||
|
NPC = NodePath("../..")
|
||||||
|
|
||||||
|
[node name="Spike" type="Node" parent="BossStateMachine" node_paths=PackedStringArray("ChooseAttackState", "Doc", "NPC")]
|
||||||
|
script = ExtResource("10_bgs6o")
|
||||||
|
Duration = 8.0
|
||||||
|
AttackDuration = 1.0
|
||||||
|
Projectile = ExtResource("9_7kavk")
|
||||||
|
ChooseAttackState = NodePath("../ChooseAttack")
|
||||||
|
Doc = NodePath("../..")
|
||||||
|
NPC = NodePath("../..")
|
||||||
|
|
||||||
|
[node name="ChooseAttack" type="Node" parent="BossStateMachine" node_paths=PackedStringArray("DartState", "SpikeState", "ExitState", "NPC")]
|
||||||
|
script = ExtResource("12_45x13")
|
||||||
|
DartState = NodePath("../Dart")
|
||||||
|
SpikeState = NodePath("../Spike")
|
||||||
|
ExitState = NodePath("../Exit")
|
||||||
|
NPC = NodePath("../..")
|
||||||
|
|
||||||
|
[node name="Exit" type="Node" parent="BossStateMachine" node_paths=PackedStringArray("TelegraphAnimationPlayer", "TelegraphState", "NPC")]
|
||||||
|
script = ExtResource("9_6com1")
|
||||||
|
TelegraphAnimationPlayer = NodePath("../../Animations/Telegraph")
|
||||||
|
TelegraphState = NodePath("../Telegraph")
|
||||||
|
NPC = NodePath("../..")
|
||||||
|
|
||||||
|
[node name="Animations" type="Node" parent="."]
|
||||||
|
|
||||||
|
[node name="Telegraph" type="AnimationPlayer" parent="Animations"]
|
||||||
|
libraries = {
|
||||||
|
"": SubResource("AnimationLibrary_rpply")
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Sprite" type="AnimatedSprite2D" parent="."]
|
||||||
|
modulate = Color(1, 1, 1, 0.5)
|
||||||
|
use_parent_material = true
|
||||||
|
position = Vector2(0, -4)
|
||||||
|
sprite_frames = SubResource("SpriteFrames_kb0pl")
|
||||||
|
animation = &"move"
|
||||||
|
frame_progress = 0.563144
|
||||||
|
offset = Vector2(0, 4)
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
visible = false
|
||||||
|
position = Vector2(0, 4)
|
||||||
|
shape = SubResource("RectangleShape2D_uict5")
|
||||||
|
|
||||||
|
[node name="Hurtbox" parent="." instance=ExtResource("7_tnve0")]
|
||||||
|
visible = false
|
||||||
|
position = Vector2(0, -4)
|
||||||
|
Faction = 2
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" parent="Hurtbox" index="0"]
|
||||||
|
position = Vector2(0, 4)
|
||||||
|
shape = SubResource("RectangleShape2D_8lxmf")
|
||||||
|
|
||||||
|
[node name="Inventory" type="Node2D" parent="."]
|
||||||
|
y_sort_enabled = true
|
||||||
|
script = ExtResource("8_r8ejq")
|
||||||
|
Items = Array[Node2D]([])
|
||||||
|
|
||||||
|
[node name="FlashAnimation" type="AnimationPlayer" parent="."]
|
||||||
|
libraries = {
|
||||||
|
"": SubResource("AnimationLibrary_xe5eq")
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="HurtSound" type="AudioStreamPlayer2D" parent="."]
|
||||||
|
stream = ExtResource("9_stm0e")
|
||||||
|
|
||||||
|
[editable path="Hurtbox"]
|
|
@ -5,12 +5,6 @@ namespace SupaLidlGame.Characters;
|
||||||
|
|
||||||
public partial class Enemy : NPC
|
public partial class Enemy : NPC
|
||||||
{
|
{
|
||||||
public override void _Ready()
|
|
||||||
{
|
|
||||||
Inventory.SelectedItem = Inventory.GetNode<Items.Item>("Sword");
|
|
||||||
base._Ready();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Die()
|
public override void Die()
|
||||||
{
|
{
|
||||||
base.Die();
|
base.Die();
|
||||||
|
|
|
@ -130,7 +130,7 @@ _data = {
|
||||||
"RESET": SubResource("Animation_k6l16")
|
"RESET": SubResource("Animation_k6l16")
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="ExampleEnemy" type="CharacterBody2D" node_paths=PackedStringArray("Sprite", "Inventory", "StateMachine")]
|
[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
|
||||||
material = SubResource("ShaderMaterial_ms3xg")
|
material = SubResource("ShaderMaterial_ms3xg")
|
||||||
|
@ -141,6 +141,7 @@ Health = 50.0
|
||||||
Sprite = NodePath("Sprite")
|
Sprite = NodePath("Sprite")
|
||||||
Inventory = NodePath("Inventory")
|
Inventory = NodePath("Inventory")
|
||||||
StateMachine = NodePath("StateMachine")
|
StateMachine = NodePath("StateMachine")
|
||||||
|
Hurtbox = NodePath("Hurtbox")
|
||||||
Faction = 2
|
Faction = 2
|
||||||
|
|
||||||
[node name="StateMachine" type="Node" parent="." node_paths=PackedStringArray("InitialState", "Character")]
|
[node name="StateMachine" type="Node" parent="." node_paths=PackedStringArray("InitialState", "Character")]
|
||||||
|
@ -191,6 +192,4 @@ libraries = {
|
||||||
[node name="HurtSound" type="AudioStreamPlayer2D" parent="."]
|
[node name="HurtSound" type="AudioStreamPlayer2D" parent="."]
|
||||||
stream = ExtResource("10_n1e64")
|
stream = ExtResource("10_n1e64")
|
||||||
|
|
||||||
[connection signal="ReceivedDamage" from="Hurtbox" to="." method="_on_hurtbox_received_damage"]
|
|
||||||
|
|
||||||
[editable path="Hurtbox"]
|
[editable path="Hurtbox"]
|
||||||
|
|
|
@ -92,8 +92,13 @@ public partial class NPC : Character
|
||||||
Character bestChar = null;
|
Character bestChar = null;
|
||||||
foreach (Node node in GetParent().GetChildren())
|
foreach (Node node in GetParent().GetChildren())
|
||||||
{
|
{
|
||||||
if (node is Character character && character.Faction != Faction)
|
if (node is Character character)
|
||||||
{
|
{
|
||||||
|
if (character.Faction == Faction || character.Health <= 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
float dist = Position.DistanceTo(character.Position);
|
float dist = Position.DistanceTo(character.Position);
|
||||||
if (dist < bestDist)
|
if (dist < bestDist)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
using Godot;
|
using Godot;
|
||||||
|
using GodotUtilities;
|
||||||
using SupaLidlGame.Utils;
|
using SupaLidlGame.Utils;
|
||||||
|
using SupaLidlGame.BoundingBoxes;
|
||||||
|
|
||||||
namespace SupaLidlGame.Characters;
|
namespace SupaLidlGame.Characters;
|
||||||
|
|
||||||
public partial class Player : Character
|
[Scene]
|
||||||
|
public sealed partial class Player : Character
|
||||||
{
|
{
|
||||||
private AnimatedSprite2D _sprite;
|
private AnimatedSprite2D _sprite;
|
||||||
private string _spriteAnim;
|
private string _spriteAnim;
|
||||||
|
@ -11,6 +14,11 @@ public partial class Player : Character
|
||||||
[Export]
|
[Export]
|
||||||
public PlayerCamera Camera { get; set; }
|
public PlayerCamera Camera { get; set; }
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public Marker2D DirectionMarker { get; private set; }
|
||||||
|
|
||||||
|
public InteractionRay InteractionRay { get; private set; }
|
||||||
|
|
||||||
public string Animation
|
public string Animation
|
||||||
{
|
{
|
||||||
get => _sprite.Animation;
|
get => _sprite.Animation;
|
||||||
|
@ -32,11 +40,31 @@ public partial class Player : Character
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
|
InteractionRay = GetNode<InteractionRay>("Direction2D/InteractionRay");
|
||||||
_sprite = GetNode<AnimatedSprite2D>("Sprite");
|
_sprite = GetNode<AnimatedSprite2D>("Sprite");
|
||||||
if (_spriteAnim != default)
|
if (_spriteAnim != default)
|
||||||
{
|
{
|
||||||
_sprite.Animation = _spriteAnim;
|
_sprite.Animation = _spriteAnim;
|
||||||
}
|
}
|
||||||
|
base._Ready();
|
||||||
|
Death += (Events.HealthChangedArgs args) =>
|
||||||
|
{
|
||||||
|
Visible = false;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void _Input(InputEvent @event)
|
||||||
|
{
|
||||||
|
if (StateMachine != null)
|
||||||
|
{
|
||||||
|
StateMachine.Input(@event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Spawn()
|
||||||
|
{
|
||||||
|
Health = 100;
|
||||||
|
Visible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ModifyVelocity()
|
public override void ModifyVelocity()
|
||||||
|
@ -61,4 +89,12 @@ public partial class Player : Character
|
||||||
GD.Print("died");
|
GD.Print("died");
|
||||||
//base.Die();
|
//base.Die();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void DrawTarget()
|
||||||
|
{
|
||||||
|
base.DrawTarget();
|
||||||
|
DirectionMarker.GlobalRotation = DirectionMarker.GlobalPosition
|
||||||
|
.DirectionTo(GetGlobalMousePosition())
|
||||||
|
.Angle();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=30 format=3 uid="uid://b2254pup8k161"]
|
[gd_scene load_steps=39 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"]
|
||||||
|
@ -11,8 +11,10 @@
|
||||||
[ext_resource type="Script" path="res://Items/Inventory.cs" id="7_xyenu"]
|
[ext_resource type="Script" path="res://Items/Inventory.cs" id="7_xyenu"]
|
||||||
[ext_resource type="Script" path="res://State/Character/PlayerRollState.cs" id="8_fy0v5"]
|
[ext_resource type="Script" path="res://State/Character/PlayerRollState.cs" id="8_fy0v5"]
|
||||||
[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="PackedScene" uid="uid://g7wfcubs6bdd" path="res://Items/Weapons/Railgun.tscn" id="10_7kb8b"]
|
[ext_resource type="AudioStream" uid="uid://bkeyg8weaqnuu" path="res://Assets/Sounds/splat-player.ogg" id="12_vvem5"]
|
||||||
[ext_resource type="AudioStream" uid="uid://njun3e6v4854" path="res://Assets/Sounds/hurt.wav" id="12_h0x0g"]
|
[ext_resource type="Script" path="res://BoundingBoxes/InteractionRay.cs" id="13_hs3u1"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://coarr28adgo1u" path="res://Assets/Sprites/Particles/point-light.png" id="14_l4ekh"]
|
||||||
|
[ext_resource type="Script" path="res://Utils/DamageTime.cs" id="15_4xl06"]
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_h78y7"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_h78y7"]
|
||||||
shader = ExtResource("2_ngsgt")
|
shader = ExtResource("2_ngsgt")
|
||||||
|
@ -89,7 +91,7 @@ animations = [{
|
||||||
}]
|
}]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_bfqew"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_bfqew"]
|
||||||
size = Vector2(16, 8)
|
size = Vector2(12, 8)
|
||||||
|
|
||||||
[sub_resource type="LabelSettings" id="LabelSettings_q5h1n"]
|
[sub_resource type="LabelSettings" id="LabelSettings_q5h1n"]
|
||||||
font_size = 24
|
font_size = 24
|
||||||
|
@ -134,19 +136,83 @@ _data = {
|
||||||
"RESET": SubResource("Animation_k6l16")
|
"RESET": SubResource("Animation_k6l16")
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="Player" type="CharacterBody2D" node_paths=PackedStringArray("Camera", "Sprite", "Inventory", "StateMachine")]
|
[sub_resource type="Animation" id="Animation_yejx2"]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Sprite:rotation")
|
||||||
|
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_rx2pj"]
|
||||||
|
resource_name = "roll"
|
||||||
|
length = 0.5
|
||||||
|
step = 0.05
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Sprite:rotation")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.25, 0.5),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [0.0, 3.14159, 6.28319]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_jai06"]
|
||||||
|
_data = {
|
||||||
|
"RESET": SubResource("Animation_yejx2"),
|
||||||
|
"roll": SubResource("Animation_rx2pj")
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Gradient" id="Gradient_3tax5"]
|
||||||
|
offsets = PackedFloat32Array(0.533333, 1)
|
||||||
|
colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 0)
|
||||||
|
|
||||||
|
[sub_resource type="GradientTexture1D" id="GradientTexture1D_pjeh8"]
|
||||||
|
gradient = SubResource("Gradient_3tax5")
|
||||||
|
|
||||||
|
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_humq0"]
|
||||||
|
emission_shape = 1
|
||||||
|
emission_sphere_radius = 1.0
|
||||||
|
particle_flag_disable_z = true
|
||||||
|
direction = Vector3(0, 0, 0)
|
||||||
|
spread = 180.0
|
||||||
|
gravity = Vector3(0, 0, 0)
|
||||||
|
initial_velocity_min = 32.0
|
||||||
|
initial_velocity_max = 32.0
|
||||||
|
orbit_velocity_min = 0.0
|
||||||
|
orbit_velocity_max = 0.1
|
||||||
|
tangential_accel_min = 64.0
|
||||||
|
tangential_accel_max = 64.0
|
||||||
|
color_ramp = SubResource("GradientTexture1D_pjeh8")
|
||||||
|
|
||||||
|
[sub_resource type="CanvasTexture" id="CanvasTexture_pited"]
|
||||||
|
|
||||||
|
[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
|
||||||
material = SubResource("ShaderMaterial_h78y7")
|
material = SubResource("ShaderMaterial_h78y7")
|
||||||
position = Vector2(0, -12)
|
position = Vector2(1, -12)
|
||||||
collision_layer = 6
|
collision_layer = 6
|
||||||
collision_mask = 17
|
collision_mask = 17
|
||||||
script = ExtResource("1_flygr")
|
script = ExtResource("1_flygr")
|
||||||
Camera = NodePath("Camera2D")
|
Camera = NodePath("Camera2D")
|
||||||
|
DirectionMarker = NodePath("Direction2D")
|
||||||
Speed = 64.0
|
Speed = 64.0
|
||||||
Sprite = NodePath("Sprite")
|
Sprite = NodePath("Sprite")
|
||||||
Inventory = NodePath("Inventory")
|
Inventory = NodePath("Inventory")
|
||||||
StateMachine = NodePath("StateMachine")
|
StateMachine = NodePath("StateMachine")
|
||||||
|
Hurtbox = NodePath("Hurtbox")
|
||||||
Faction = 1
|
Faction = 1
|
||||||
|
|
||||||
[node name="StateMachine" type="Node" parent="." node_paths=PackedStringArray("InitialState", "Character")]
|
[node name="StateMachine" type="Node" parent="." node_paths=PackedStringArray("InitialState", "Character")]
|
||||||
|
@ -176,8 +242,10 @@ position_smoothing_speed = 8.0
|
||||||
|
|
||||||
[node name="Sprite" type="AnimatedSprite2D" parent="."]
|
[node name="Sprite" type="AnimatedSprite2D" parent="."]
|
||||||
use_parent_material = true
|
use_parent_material = true
|
||||||
|
position = Vector2(0, 4)
|
||||||
sprite_frames = SubResource("SpriteFrames_2h7cf")
|
sprite_frames = SubResource("SpriteFrames_2h7cf")
|
||||||
animation = &"idle"
|
animation = &"idle"
|
||||||
|
offset = Vector2(0, -4)
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
position = Vector2(0, 8)
|
position = Vector2(0, 8)
|
||||||
|
@ -201,7 +269,6 @@ horizontal_alignment = 1
|
||||||
[node name="Node" type="Node" parent="."]
|
[node name="Node" type="Node" parent="."]
|
||||||
|
|
||||||
[node name="Inventory" type="Node2D" parent="."]
|
[node name="Inventory" type="Node2D" parent="."]
|
||||||
y_sort_enabled = true
|
|
||||||
position = Vector2(0, 4)
|
position = Vector2(0, 4)
|
||||||
script = ExtResource("7_xyenu")
|
script = ExtResource("7_xyenu")
|
||||||
InventoryMap = {
|
InventoryMap = {
|
||||||
|
@ -209,9 +276,8 @@ InventoryMap = {
|
||||||
"equip_2": 1
|
"equip_2": 1
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="Railgun" parent="Inventory" instance=ExtResource("10_7kb8b")]
|
|
||||||
|
|
||||||
[node name="Node2D" parent="Inventory" instance=ExtResource("7_4rxuv")]
|
[node name="Node2D" parent="Inventory" instance=ExtResource("7_4rxuv")]
|
||||||
|
visible = false
|
||||||
ShouldHideIdle = false
|
ShouldHideIdle = false
|
||||||
|
|
||||||
[node name="Hurtbox" parent="." instance=ExtResource("9_avyu4")]
|
[node name="Hurtbox" parent="." instance=ExtResource("9_avyu4")]
|
||||||
|
@ -226,13 +292,44 @@ libraries = {
|
||||||
"": SubResource("AnimationLibrary_xe5eq")
|
"": SubResource("AnimationLibrary_xe5eq")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[node name="RollAnimation" type="AnimationPlayer" parent="."]
|
||||||
|
libraries = {
|
||||||
|
"": SubResource("AnimationLibrary_jai06")
|
||||||
|
}
|
||||||
|
|
||||||
[node name="HurtSound" type="AudioStreamPlayer2D" parent="."]
|
[node name="HurtSound" type="AudioStreamPlayer2D" parent="."]
|
||||||
stream = ExtResource("12_h0x0g")
|
stream = ExtResource("12_vvem5")
|
||||||
max_distance = 64.0
|
max_distance = 64.0
|
||||||
|
|
||||||
[node name="AudioListener2D" type="AudioListener2D" parent="."]
|
[node name="AudioListener2D" type="AudioListener2D" parent="."]
|
||||||
current = true
|
current = true
|
||||||
|
|
||||||
[connection signal="ReceivedDamage" from="Hurtbox" to="." method="_on_hurtbox_received_damage"]
|
[node name="Direction2D" type="Marker2D" parent="."]
|
||||||
|
position = Vector2(0, 6)
|
||||||
|
|
||||||
|
[node name="InteractionRay" type="RayCast2D" parent="Direction2D"]
|
||||||
|
target_position = Vector2(16, 0)
|
||||||
|
collision_mask = 64
|
||||||
|
collide_with_areas = true
|
||||||
|
script = ExtResource("13_hs3u1")
|
||||||
|
|
||||||
|
[node name="DeathParticles" type="GPUParticles2D" parent="."]
|
||||||
|
emitting = false
|
||||||
|
amount = 16
|
||||||
|
process_material = SubResource("ParticleProcessMaterial_humq0")
|
||||||
|
texture = SubResource("CanvasTexture_pited")
|
||||||
|
one_shot = true
|
||||||
|
explosiveness = 0.9
|
||||||
|
|
||||||
|
[node name="PointLight2D" type="PointLight2D" parent="."]
|
||||||
|
blend_mode = 2
|
||||||
|
shadow_enabled = true
|
||||||
|
shadow_filter = 2
|
||||||
|
shadow_filter_smooth = 3.0
|
||||||
|
texture = ExtResource("14_l4ekh")
|
||||||
|
texture_scale = 0.5
|
||||||
|
|
||||||
|
[node name="DamageTime" type="Node" parent="."]
|
||||||
|
script = ExtResource("15_4xl06")
|
||||||
|
|
||||||
[editable path="Hurtbox"]
|
[editable path="Hurtbox"]
|
||||||
|
|
|
@ -1,23 +1,35 @@
|
||||||
using Godot;
|
using Godot;
|
||||||
using System;
|
using GodotUtilities;
|
||||||
|
using SupaLidlGame.BoundingBoxes;
|
||||||
|
|
||||||
namespace SupaLidlGame.Entities;
|
namespace SupaLidlGame.Entities;
|
||||||
|
|
||||||
public partial class Campfire : StaticBody2D
|
[Scene]
|
||||||
|
public partial class Campfire : StaticBody2D, Utils.IInteractive
|
||||||
{
|
{
|
||||||
private PointLight2D _light;
|
private PointLight2D _light;
|
||||||
|
|
||||||
|
public InteractionTrigger InteractionTrigger { get; set; }
|
||||||
|
|
||||||
[Signal]
|
[Signal]
|
||||||
public delegate void OnCampfireUseEventHandler();
|
public delegate void UseEventHandler();
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
|
InteractionTrigger = GetNode<InteractionTrigger>("InteractionTrigger");
|
||||||
_light = GetNode<PointLight2D>("PointLight2D");
|
_light = GetNode<PointLight2D>("PointLight2D");
|
||||||
|
InteractionTrigger.Interaction += () =>
|
||||||
|
{
|
||||||
|
// save the player's spawn position to be their position on interaction
|
||||||
|
EmitSignal(SignalName.Use);
|
||||||
|
|
||||||
|
this.GetAncestor<Utils.World>().SetSpawn(GlobalPosition);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void _Process(double delta)
|
public override void _Process(double delta)
|
||||||
{
|
{
|
||||||
_light.Energy += (GD.Randf() - 0.5f) * 8 * (float)delta;
|
_light.Energy += (GD.Randf() - 0.5f) * 8 * (float)delta;
|
||||||
_light.Energy = Math.Clamp(_light.Energy, 1.2f, 2.0f);
|
_light.Energy = Mathf.Clamp(_light.Energy, 1.8f, 2f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
[gd_scene load_steps=11 format=3 uid="uid://dhl071rj5wyvx"]
|
[gd_scene load_steps=18 format=3 uid="uid://dhl071rj5wyvx"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://yqet0b22i70d" path="res://Assets/Sprites/campfire.png" id="1_7eor7"]
|
[ext_resource type="Texture2D" uid="uid://yqet0b22i70d" path="res://Assets/Sprites/campfire.png" id="1_7eor7"]
|
||||||
[ext_resource type="Script" path="res://Entities/Campfire.cs" id="1_w4gfp"]
|
[ext_resource type="Script" path="res://Entities/Campfire.cs" id="1_w4gfp"]
|
||||||
[ext_resource type="Texture2D" uid="uid://coarr28adgo1u" path="res://Assets/Sprites/Particles/point-light.png" id="3_lm3vq"]
|
[ext_resource type="Texture2D" uid="uid://coarr28adgo1u" path="res://Assets/Sprites/Particles/point-light.png" id="3_lm3vq"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dldnp8eunxj3q" path="res://BoundingBoxes/InteractionTrigger.tscn" id="4_yoo3p"]
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_68qj1"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_68qj1"]
|
||||||
atlas = ExtResource("1_7eor7")
|
atlas = ExtResource("1_7eor7")
|
||||||
|
@ -55,6 +56,41 @@ animations = [{
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ubam4"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ubam4"]
|
||||||
size = Vector2(16, 4)
|
size = Vector2(16, 4)
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_p0hsm"]
|
||||||
|
size = Vector2(20, 10)
|
||||||
|
|
||||||
|
[sub_resource type="Gradient" id="Gradient_cr0xb"]
|
||||||
|
offsets = PackedFloat32Array(0, 0.644444, 1)
|
||||||
|
colors = PackedColorArray(2, 1.6, 0.8, 1, 0.863171, 0.393552, 0.380535, 1, 0.304405, 0.24341, 0.229614, 1)
|
||||||
|
|
||||||
|
[sub_resource type="GradientTexture1D" id="GradientTexture1D_pjqf7"]
|
||||||
|
gradient = SubResource("Gradient_cr0xb")
|
||||||
|
|
||||||
|
[sub_resource type="Curve" id="Curve_jm83f"]
|
||||||
|
_data = [Vector2(0.144578, 1), 0.0, 0.0, 0, 0, Vector2(1, 0.4), 0.0, 0.0, 0, 0]
|
||||||
|
point_count = 2
|
||||||
|
|
||||||
|
[sub_resource type="CurveTexture" id="CurveTexture_jpefi"]
|
||||||
|
curve = SubResource("Curve_jm83f")
|
||||||
|
|
||||||
|
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_xtx2m"]
|
||||||
|
emission_shape = 1
|
||||||
|
emission_sphere_radius = 5.0
|
||||||
|
particle_flag_disable_z = true
|
||||||
|
direction = Vector3(0, -1, 0)
|
||||||
|
spread = 0.0
|
||||||
|
gravity = Vector3(0, -16, 0)
|
||||||
|
initial_velocity_min = 16.0
|
||||||
|
initial_velocity_max = 16.0
|
||||||
|
orbit_velocity_min = 0.0
|
||||||
|
orbit_velocity_max = 0.0
|
||||||
|
radial_accel_min = -40.0
|
||||||
|
radial_accel_max = -20.0
|
||||||
|
scale_min = 2.0
|
||||||
|
scale_max = 4.0
|
||||||
|
scale_curve = SubResource("CurveTexture_jpefi")
|
||||||
|
color_ramp = SubResource("GradientTexture1D_pjqf7")
|
||||||
|
|
||||||
[node name="Campfire" type="StaticBody2D"]
|
[node name="Campfire" type="StaticBody2D"]
|
||||||
texture_filter = 3
|
texture_filter = 3
|
||||||
position = Vector2(0, -8)
|
position = Vector2(0, -8)
|
||||||
|
@ -62,15 +98,29 @@ script = ExtResource("1_w4gfp")
|
||||||
|
|
||||||
[node name="Sprite2D" type="AnimatedSprite2D" parent="."]
|
[node name="Sprite2D" type="AnimatedSprite2D" parent="."]
|
||||||
sprite_frames = SubResource("SpriteFrames_o6lfi")
|
sprite_frames = SubResource("SpriteFrames_o6lfi")
|
||||||
frame_progress = 0.387757
|
animation = &"active"
|
||||||
|
frame_progress = 0.343741
|
||||||
|
|
||||||
[node name="PointLight2D" type="PointLight2D" parent="."]
|
[node name="PointLight2D" type="PointLight2D" parent="."]
|
||||||
color = Color(0.996078, 0.780392, 0.615686, 1)
|
color = Color(0.996078, 0.780392, 0.615686, 1)
|
||||||
energy = 2.0
|
energy = 2.0
|
||||||
blend_mode = 2
|
blend_mode = 2
|
||||||
|
shadow_enabled = true
|
||||||
texture = ExtResource("3_lm3vq")
|
texture = ExtResource("3_lm3vq")
|
||||||
texture_scale = 0.25
|
texture_scale = 0.25
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
position = Vector2(0, 6)
|
position = Vector2(0, 6)
|
||||||
shape = SubResource("RectangleShape2D_ubam4")
|
shape = SubResource("RectangleShape2D_ubam4")
|
||||||
|
|
||||||
|
[node name="InteractionTrigger" parent="." instance=ExtResource("4_yoo3p")]
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" parent="InteractionTrigger" index="0"]
|
||||||
|
position = Vector2(0, 5)
|
||||||
|
shape = SubResource("RectangleShape2D_p0hsm")
|
||||||
|
|
||||||
|
[node name="GPUParticles2D" type="GPUParticles2D" parent="."]
|
||||||
|
amount = 40
|
||||||
|
process_material = SubResource("ParticleProcessMaterial_xtx2m")
|
||||||
|
|
||||||
|
[editable path="InteractionTrigger"]
|
||||||
|
|
|
@ -20,10 +20,22 @@ public partial class Projectile : RigidBody2D
|
||||||
[Export]
|
[Export]
|
||||||
public double Lifetime { get; set; } = 10;
|
public double Lifetime { get; set; } = 10;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public double Delay { get; set; } = 0;
|
||||||
|
|
||||||
public Character Character { get; set; }
|
public Character Character { get; set; }
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
Hitbox.Hit += OnHit;
|
||||||
|
}
|
||||||
|
|
||||||
public override void _Process(double delta)
|
public override void _Process(double delta)
|
||||||
{
|
{
|
||||||
|
if (Delay > 0)
|
||||||
|
{
|
||||||
|
Delay -= delta;
|
||||||
|
}
|
||||||
if ((Lifetime -= delta) <= 0)
|
if ((Lifetime -= delta) <= 0)
|
||||||
{
|
{
|
||||||
QueueFree();
|
QueueFree();
|
||||||
|
@ -32,11 +44,11 @@ public partial class Projectile : RigidBody2D
|
||||||
|
|
||||||
public override void _PhysicsProcess(double delta)
|
public override void _PhysicsProcess(double delta)
|
||||||
{
|
{
|
||||||
Vector2 velocity = Velocity;
|
Vector2 velocity = Delay <= 0 ? Velocity : Vector2.Zero;
|
||||||
MoveAndCollide(velocity * (float)delta);
|
MoveAndCollide(velocity * (float)delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void _on_hitbox_hit(BoundingBox box)
|
public void OnHit(BoundingBox box)
|
||||||
{
|
{
|
||||||
if (box is Hurtbox hurtbox)
|
if (box is Hurtbox hurtbox)
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,6 +27,4 @@ Knockback = 256.0
|
||||||
[node name="CollisionShape2D" parent="Hitbox" index="0"]
|
[node name="CollisionShape2D" parent="Hitbox" index="0"]
|
||||||
shape = SubResource("RectangleShape2D_j0tne")
|
shape = SubResource("RectangleShape2D_j0tne")
|
||||||
|
|
||||||
[connection signal="Hit" from="Hitbox" to="." method="_on_hitbox_hit"]
|
|
||||||
|
|
||||||
[editable path="Hitbox"]
|
[editable path="Hitbox"]
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace SupaLidlGame.Entities;
|
||||||
|
|
||||||
|
public partial class ShungiteDart : Projectile
|
||||||
|
{
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
var player = GetNode<AnimationPlayer>("AnimationPlayer");
|
||||||
|
if (Delay > 0)
|
||||||
|
{
|
||||||
|
player.Play("spin");
|
||||||
|
player.SpeedScale = (float)(1 / Delay);
|
||||||
|
}
|
||||||
|
base._Ready();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,303 @@
|
||||||
|
[gd_scene load_steps=41 format=3 uid="uid://djaljmco3xo4g"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://Entities/ShungiteDart.cs" id="1_jbgb8"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://dmeqjcc3uu4xi" path="res://Assets/Sprites/Misc/shungite.png" id="2_eh4e1"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://du5vhccg75nrq" path="res://BoundingBoxes/Hitbox.tscn" id="3_gdyk8"]
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_xmjp8"]
|
||||||
|
atlas = ExtResource("2_eh4e1")
|
||||||
|
region = Rect2(0, 0, 8, 8)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_8i61s"]
|
||||||
|
atlas = ExtResource("2_eh4e1")
|
||||||
|
region = Rect2(8, 0, 8, 8)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_q000r"]
|
||||||
|
atlas = ExtResource("2_eh4e1")
|
||||||
|
region = Rect2(16, 0, 8, 8)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_0f7fg"]
|
||||||
|
atlas = ExtResource("2_eh4e1")
|
||||||
|
region = Rect2(24, 0, 8, 8)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_d34ii"]
|
||||||
|
atlas = ExtResource("2_eh4e1")
|
||||||
|
region = Rect2(32, 0, 8, 8)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_iybvf"]
|
||||||
|
atlas = ExtResource("2_eh4e1")
|
||||||
|
region = Rect2(40, 0, 8, 8)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_rninu"]
|
||||||
|
atlas = ExtResource("2_eh4e1")
|
||||||
|
region = Rect2(48, 0, 8, 8)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_8vok2"]
|
||||||
|
atlas = ExtResource("2_eh4e1")
|
||||||
|
region = Rect2(56, 0, 8, 8)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_7tcc7"]
|
||||||
|
atlas = ExtResource("2_eh4e1")
|
||||||
|
region = Rect2(64, 0, 8, 8)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_sfa0w"]
|
||||||
|
atlas = ExtResource("2_eh4e1")
|
||||||
|
region = Rect2(72, 0, 8, 8)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_21chc"]
|
||||||
|
atlas = ExtResource("2_eh4e1")
|
||||||
|
region = Rect2(80, 0, 8, 8)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_iroma"]
|
||||||
|
atlas = ExtResource("2_eh4e1")
|
||||||
|
region = Rect2(88, 0, 8, 8)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_hbl5e"]
|
||||||
|
atlas = ExtResource("2_eh4e1")
|
||||||
|
region = Rect2(96, 0, 8, 8)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_qlpso"]
|
||||||
|
atlas = ExtResource("2_eh4e1")
|
||||||
|
region = Rect2(104, 0, 8, 8)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_v65pa"]
|
||||||
|
atlas = ExtResource("2_eh4e1")
|
||||||
|
region = Rect2(112, 0, 8, 8)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_jotwh"]
|
||||||
|
atlas = ExtResource("2_eh4e1")
|
||||||
|
region = Rect2(120, 0, 8, 8)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_lu113"]
|
||||||
|
atlas = ExtResource("2_eh4e1")
|
||||||
|
region = Rect2(128, 0, 8, 8)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_w332l"]
|
||||||
|
atlas = ExtResource("2_eh4e1")
|
||||||
|
region = Rect2(136, 0, 8, 8)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_mg73k"]
|
||||||
|
atlas = ExtResource("2_eh4e1")
|
||||||
|
region = Rect2(144, 0, 8, 8)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_m0ogr"]
|
||||||
|
atlas = ExtResource("2_eh4e1")
|
||||||
|
region = Rect2(152, 0, 8, 8)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_py1jk"]
|
||||||
|
atlas = ExtResource("2_eh4e1")
|
||||||
|
region = Rect2(160, 0, 8, 8)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_0a8wd"]
|
||||||
|
atlas = ExtResource("2_eh4e1")
|
||||||
|
region = Rect2(168, 0, 8, 8)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_8ut6e"]
|
||||||
|
atlas = ExtResource("2_eh4e1")
|
||||||
|
region = Rect2(176, 0, 8, 8)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_x5ucf"]
|
||||||
|
atlas = ExtResource("2_eh4e1")
|
||||||
|
region = Rect2(184, 0, 8, 8)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_13nfm"]
|
||||||
|
atlas = ExtResource("2_eh4e1")
|
||||||
|
region = Rect2(192, 0, 8, 8)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_uhjdb"]
|
||||||
|
atlas = ExtResource("2_eh4e1")
|
||||||
|
region = Rect2(200, 0, 8, 8)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_4vrn8"]
|
||||||
|
atlas = ExtResource("2_eh4e1")
|
||||||
|
region = Rect2(208, 0, 8, 8)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_4aa2t"]
|
||||||
|
atlas = ExtResource("2_eh4e1")
|
||||||
|
region = Rect2(216, 0, 8, 8)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_tn6f5"]
|
||||||
|
atlas = ExtResource("2_eh4e1")
|
||||||
|
region = Rect2(224, 0, 8, 8)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_60mwy"]
|
||||||
|
atlas = ExtResource("2_eh4e1")
|
||||||
|
region = Rect2(232, 0, 8, 8)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_d0xqb"]
|
||||||
|
atlas = ExtResource("2_eh4e1")
|
||||||
|
region = Rect2(240, 0, 8, 8)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_j2hu2"]
|
||||||
|
atlas = ExtResource("2_eh4e1")
|
||||||
|
region = Rect2(248, 0, 8, 8)
|
||||||
|
|
||||||
|
[sub_resource type="SpriteFrames" id="SpriteFrames_6a2jq"]
|
||||||
|
animations = [{
|
||||||
|
"frames": [{
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_xmjp8")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_8i61s")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_q000r")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_0f7fg")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_d34ii")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_iybvf")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_rninu")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_8vok2")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_7tcc7")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_sfa0w")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_21chc")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_iroma")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_hbl5e")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_qlpso")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_v65pa")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_jotwh")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_lu113")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_w332l")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_mg73k")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_m0ogr")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_py1jk")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_0a8wd")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_8ut6e")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_x5ucf")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_13nfm")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_uhjdb")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_4vrn8")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_4aa2t")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_tn6f5")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_60mwy")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_d0xqb")
|
||||||
|
}, {
|
||||||
|
"duration": 1.0,
|
||||||
|
"texture": SubResource("AtlasTexture_j2hu2")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"default",
|
||||||
|
"speed": 5.0
|
||||||
|
}]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_fa7yf"]
|
||||||
|
size = Vector2(8, 4)
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_tcdo0"]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Sprite2D:rotation")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [1.5708]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_tgj7f"]
|
||||||
|
resource_name = "spin"
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Sprite2D:rotation")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.5),
|
||||||
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [-4.71239, 1.5708]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_pehte"]
|
||||||
|
_data = {
|
||||||
|
"RESET": SubResource("Animation_tcdo0"),
|
||||||
|
"spin": SubResource("Animation_tgj7f")
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="ShungiteDart" type="RigidBody2D" node_paths=PackedStringArray("Hitbox")]
|
||||||
|
script = ExtResource("1_jbgb8")
|
||||||
|
Speed = 256.0
|
||||||
|
Hitbox = NodePath("Hitbox")
|
||||||
|
Delay = 1.0
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="AnimatedSprite2D" parent="."]
|
||||||
|
texture_filter = 1
|
||||||
|
rotation = 1.5708
|
||||||
|
sprite_frames = SubResource("SpriteFrames_6a2jq")
|
||||||
|
frame_progress = 0.227702
|
||||||
|
speed_scale = 4.0
|
||||||
|
|
||||||
|
[node name="Hitbox" parent="." instance=ExtResource("3_gdyk8")]
|
||||||
|
Damage = 25.0
|
||||||
|
Knockback = 128.0
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" parent="Hitbox" index="0"]
|
||||||
|
shape = SubResource("RectangleShape2D_fa7yf")
|
||||||
|
|
||||||
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||||
|
libraries = {
|
||||||
|
"": SubResource("AnimationLibrary_pehte")
|
||||||
|
}
|
||||||
|
|
||||||
|
[editable path="Hitbox"]
|
|
@ -0,0 +1,72 @@
|
||||||
|
using Godot;
|
||||||
|
using GodotUtilities;
|
||||||
|
using SupaLidlGame.Extensions;
|
||||||
|
|
||||||
|
namespace SupaLidlGame.Entities;
|
||||||
|
|
||||||
|
public partial class ShungiteSpike : Projectile
|
||||||
|
{
|
||||||
|
[Export]
|
||||||
|
public PackedScene Dart { get; set; }
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public double ExplodeTime { get; set; } = 6;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public BoundingBoxes.Hurtbox Hurtbox { get; set; }
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public AudioStreamPlayer2D HitSound { get; set; }
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public AnimationPlayer AnimationPlayer { get; set; }
|
||||||
|
|
||||||
|
private double _currentExplodeTime;
|
||||||
|
|
||||||
|
private Scenes.Map _map;
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
_currentExplodeTime = ExplodeTime;
|
||||||
|
_map = this.GetAncestor<Scenes.Map>();
|
||||||
|
|
||||||
|
Hurtbox.ReceivedDamage += OnReceivedDamage;
|
||||||
|
AnimationPlayer.Play("spin");
|
||||||
|
|
||||||
|
base._Ready();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnReceivedDamage(
|
||||||
|
float damage,
|
||||||
|
Characters.Character inflictor,
|
||||||
|
float knockback,
|
||||||
|
Vector2 knockbackOrigin = default,
|
||||||
|
Vector2 knockbackVector = default)
|
||||||
|
{
|
||||||
|
HitSound.At(GlobalPosition).PlayOneShot();
|
||||||
|
QueueFree();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private Entities.ShungiteDart CreateDart(Vector2 direction)
|
||||||
|
{
|
||||||
|
var dart = _map.SpawnEntity<Entities.ShungiteDart>(Dart);
|
||||||
|
dart.Direction = direction;
|
||||||
|
dart.Hitbox.Faction = Hitbox.Faction;
|
||||||
|
dart.GlobalPosition = GlobalPosition;
|
||||||
|
dart.Delay = 0;
|
||||||
|
return dart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void _Process(double delta)
|
||||||
|
{
|
||||||
|
if ((_currentExplodeTime -= delta) <= 0)
|
||||||
|
{
|
||||||
|
CreateDart(Vector2.Up);
|
||||||
|
CreateDart(Vector2.Down);
|
||||||
|
CreateDart(Vector2.Left);
|
||||||
|
CreateDart(Vector2.Right);
|
||||||
|
QueueFree();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,87 @@
|
||||||
|
[gd_scene load_steps=12 format=3 uid="uid://1tiswf3gtyvv"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://Entities/ShungiteSpike.cs" id="1_pclpe"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://djaljmco3xo4g" path="res://Entities/ShungiteDart.tscn" id="2_hinxt"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://dvx2b0y6dup53" path="res://Assets/Sprites/Misc/shungite-spike.png" id="2_klp8v"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://du5vhccg75nrq" path="res://BoundingBoxes/Hitbox.tscn" id="3_kojrj"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://cjgxyhgcyvsv7" path="res://BoundingBoxes/Hurtbox.tscn" id="4_d8dl4"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://c4n7ioxpukdwi" path="res://Assets/Sounds/parry.wav" id="6_fepye"]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_konb7"]
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_kumrg"]
|
||||||
|
radius = 20.0
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_dlpaa"]
|
||||||
|
resource_name = "spin"
|
||||||
|
length = 0.5
|
||||||
|
loop_mode = 1
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Sprite2D:rotation")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.5),
|
||||||
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [0.0, 6.28319]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_0vfvo"]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Sprite2D:rotation")
|
||||||
|
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_jj1qe"]
|
||||||
|
_data = {
|
||||||
|
"RESET": SubResource("Animation_0vfvo"),
|
||||||
|
"spin": SubResource("Animation_dlpaa")
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="ShungiteSpike" type="RigidBody2D" node_paths=PackedStringArray("Hurtbox", "HitSound", "Hitbox")]
|
||||||
|
script = ExtResource("1_pclpe")
|
||||||
|
Dart = ExtResource("2_hinxt")
|
||||||
|
Hurtbox = NodePath("Hurtbox")
|
||||||
|
HitSound = NodePath("AudioStreamPlayer2D")
|
||||||
|
Hitbox = NodePath("Hitbox")
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
|
modulate = Color(1.4, 0, 1.2, 1)
|
||||||
|
self_modulate = Color(2, 2, 2, 1)
|
||||||
|
texture_filter = 1
|
||||||
|
texture = ExtResource("2_klp8v")
|
||||||
|
|
||||||
|
[node name="Hitbox" parent="." instance=ExtResource("3_kojrj")]
|
||||||
|
Damage = 10.0
|
||||||
|
Knockback = 256.0
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" parent="Hitbox" index="0"]
|
||||||
|
shape = SubResource("RectangleShape2D_konb7")
|
||||||
|
|
||||||
|
[node name="Hurtbox" parent="." instance=ExtResource("4_d8dl4")]
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" parent="Hurtbox" index="0"]
|
||||||
|
shape = SubResource("CircleShape2D_kumrg")
|
||||||
|
|
||||||
|
[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."]
|
||||||
|
stream = ExtResource("6_fepye")
|
||||||
|
|
||||||
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||||
|
libraries = {
|
||||||
|
"": SubResource("AnimationLibrary_jj1qe")
|
||||||
|
}
|
||||||
|
|
||||||
|
[editable path="Hitbox"]
|
||||||
|
[editable path="Hurtbox"]
|
|
@ -0,0 +1,8 @@
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace SupaLidlGame.Events;
|
||||||
|
|
||||||
|
public abstract partial class Args : GodotObject
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
namespace SupaLidlGame.Events;
|
||||||
|
|
||||||
|
public partial class HealthChangedArgs : Args
|
||||||
|
{
|
||||||
|
public Characters.Character Attacker { get; set; }
|
||||||
|
|
||||||
|
public Items.Weapon Weapon { get; set; }
|
||||||
|
|
||||||
|
public float OldHealth { get; set; }
|
||||||
|
|
||||||
|
public float NewHealth { get; set; }
|
||||||
|
|
||||||
|
public float Damage { get; set; }
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
using Godot;
|
using Godot;
|
||||||
|
using GodotUtilities;
|
||||||
using System;
|
using System;
|
||||||
using SupaLidlGame.Utils;
|
|
||||||
|
|
||||||
namespace SupaLidlGame.Extensions;
|
namespace SupaLidlGame.Extensions;
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ public static class AudioStreamPlayer2DExtensions
|
||||||
this AudioStreamPlayer2D audio,
|
this AudioStreamPlayer2D audio,
|
||||||
Vector2 globalPosition)
|
Vector2 globalPosition)
|
||||||
{
|
{
|
||||||
var world = audio.GetTree().Root.GetNode("World/TileMap");
|
var world = audio.GetAncestor<Scenes.Map>();
|
||||||
if (world is null)
|
if (world is null)
|
||||||
{
|
{
|
||||||
throw new NullReferenceException("World does not exist");
|
throw new NullReferenceException("World does not exist");
|
||||||
|
@ -62,6 +62,15 @@ public static class AudioStreamPlayer2DExtensions
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static AudioStreamPlayer2D PlayOneShot(
|
||||||
|
this AudioStreamPlayer2D audio,
|
||||||
|
float fromPosition = 0)
|
||||||
|
{
|
||||||
|
audio.Finished += () => audio.QueueFree();
|
||||||
|
audio.Play(fromPosition);
|
||||||
|
return audio;
|
||||||
|
}
|
||||||
|
|
||||||
public static AudioStreamPlayer2D WithPitchDeviation(
|
public static AudioStreamPlayer2D WithPitchDeviation(
|
||||||
this AudioStreamPlayer2D audio,
|
this AudioStreamPlayer2D audio,
|
||||||
float deviation)
|
float deviation)
|
||||||
|
|
|
@ -8,7 +8,8 @@ public static class NodeExtensions
|
||||||
/// Iterates through each ancestor until it finds an ancestor of type
|
/// Iterates through each ancestor until it finds an ancestor of type
|
||||||
/// <c>T</c>
|
/// <c>T</c>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static T GetAncestor<T>(this Node node) where T : Node
|
[System.Obsolete]
|
||||||
|
public static T GetAncestorDeprecated<T>(this Node node) where T : Node
|
||||||
{
|
{
|
||||||
Node parent;
|
Node parent;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using Godot;
|
using Godot;
|
||||||
|
using GodotUtilities;
|
||||||
|
|
||||||
namespace SupaLidlGame.Extensions;
|
namespace SupaLidlGame.Extensions;
|
||||||
|
|
||||||
|
@ -9,4 +10,32 @@ public static class Node2DExtensions
|
||||||
//var spaceState = node.GetWorld2d().DirectSpaceState;
|
//var spaceState = node.GetWorld2d().DirectSpaceState;
|
||||||
//var result = spaceState.IntersectRay();
|
//var result = spaceState.IntersectRay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Node CloneOnWorld(this Node2D node)
|
||||||
|
{
|
||||||
|
return CloneOnWorld<Node2D>(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static T CloneOnWorld<T>(this Node2D node) where T : Node2D
|
||||||
|
{
|
||||||
|
var world = node.GetAncestor<Scenes.Map>();
|
||||||
|
if (world is null)
|
||||||
|
{
|
||||||
|
throw new System.NullReferenceException("World does not exist");
|
||||||
|
}
|
||||||
|
|
||||||
|
//var parent = new Node2D();
|
||||||
|
//world.AddChild(parent);
|
||||||
|
//parent.GlobalPosition = node.GlobalPosition;
|
||||||
|
var clone = node.Duplicate() as T;
|
||||||
|
world.AddChild(clone);
|
||||||
|
clone.GlobalPosition = node.GlobalPosition;
|
||||||
|
return clone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Node AtPosition(this Node2D node, Vector2 position)
|
||||||
|
{
|
||||||
|
node.GlobalPosition = position;
|
||||||
|
return node;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace SupaLidlGame.Extensions;
|
||||||
|
|
||||||
|
public static class Particles2D
|
||||||
|
{
|
||||||
|
public static void EmitOneShot(this GpuParticles2D particles)
|
||||||
|
{
|
||||||
|
particles.GetTree().CreateTimer(particles.Lifetime).Timeout += () =>
|
||||||
|
{
|
||||||
|
particles.QueueFree();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
using Godot;
|
using Godot;
|
||||||
using SupaLidlGame.Extensions;
|
using GodotUtilities;
|
||||||
|
|
||||||
namespace SupaLidlGame.Items.Weapons;
|
namespace SupaLidlGame.Items.Weapons;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using Godot;
|
using Godot;
|
||||||
|
using GodotUtilities;
|
||||||
using SupaLidlGame.BoundingBoxes;
|
using SupaLidlGame.BoundingBoxes;
|
||||||
using SupaLidlGame.Characters;
|
using SupaLidlGame.Characters;
|
||||||
using SupaLidlGame.Extensions;
|
using SupaLidlGame.Extensions;
|
||||||
|
@ -197,7 +198,7 @@ public partial class Sword : Weapon, IParryable
|
||||||
IsParried = true;
|
IsParried = true;
|
||||||
AnimationPlayer.SpeedScale = 0.25f;
|
AnimationPlayer.SpeedScale = 0.25f;
|
||||||
Character.Stun(1.5f);
|
Character.Stun(1.5f);
|
||||||
GetNode<AudioStreamPlayer2D>("ParrySound").OnWorld().Play();
|
GetNode<AudioStreamPlayer2D>("ParrySound").OnWorld().PlayOneShot();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void _on_hitbox_hit(BoundingBox box)
|
public override void _on_hitbox_hit(BoundingBox box)
|
||||||
|
|
|
@ -340,13 +340,13 @@ Hitbox = NodePath("Hitbox")
|
||||||
AnimationPlayer = NodePath("AnimationPlayer")
|
AnimationPlayer = NodePath("AnimationPlayer")
|
||||||
AnimationTree = NodePath("AnimationTree")
|
AnimationTree = NodePath("AnimationTree")
|
||||||
AttackTime = 0.2
|
AttackTime = 0.2
|
||||||
AttackAnimationDuration = 1.0
|
AttackAnimationDuration = 0.75
|
||||||
ParryParticles = NodePath("Anchor/Node2D/Sprite2D/ParryParticles")
|
ParryParticles = NodePath("Anchor/Node2D/Sprite2D/ParryParticles")
|
||||||
NPCAnticipateTime = 0.3
|
NPCAnticipateTime = 0.3
|
||||||
StateMachine = NodePath("State")
|
StateMachine = NodePath("State")
|
||||||
Anchor = NodePath("Anchor")
|
Anchor = NodePath("Anchor")
|
||||||
Damage = 20.0
|
Damage = 20.0
|
||||||
UseTime = 0.8
|
UseTime = 0.55
|
||||||
Knockback = 64.0
|
Knockback = 64.0
|
||||||
ShouldHideIdle = true
|
ShouldHideIdle = true
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
[gd_scene load_steps=3 format=3 uid="uid://1pb3mpmrl7lc"]
|
[gd_scene load_steps=3 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://bxtpv6jqodj4v" path="res://Scenes/Maps/Hills.tscn" id="2_juio7"]
|
[ext_resource type="PackedScene" uid="uid://b2x17su05ou5w" path="res://Scenes/Maps/Arena.tscn" id="2_avsrq"]
|
||||||
|
|
||||||
[node name="World" type="Node2D"]
|
[node name="World" type="Node2D"]
|
||||||
script = ExtResource("1_1k6ew")
|
script = ExtResource("1_1k6ew")
|
||||||
StartingArea = ExtResource("2_juio7")
|
StartingArea = ExtResource("2_avsrq")
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using Godot;
|
using Godot;
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace SupaLidlGame.Scenes;
|
namespace SupaLidlGame.Scenes;
|
||||||
|
|
||||||
|
@ -30,7 +29,7 @@ public partial class Map : TileMap
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_active = Visible = value;
|
_active = Visible = value;
|
||||||
SetProcess(value);
|
SetProcess(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,4 +43,16 @@ public partial class Map : TileMap
|
||||||
{
|
{
|
||||||
base._Process(delta);
|
base._Process(delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Node SpawnEntity(PackedScene scene)
|
||||||
|
{
|
||||||
|
var instance = scene.Instantiate();
|
||||||
|
Entities.AddChild(instance);
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T SpawnEntity<T>(PackedScene scene) where T : Node
|
||||||
|
{
|
||||||
|
return SpawnEntity(scene) as T;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,273 @@
|
||||||
|
[gd_scene load_steps=13 format=3 uid="uid://b2x17su05ou5w"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://clwv2owvk6abe" path="res://Scenes/BaseMap.tscn" id="1_ifiic"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://b0yiy7w8nxmas" path="res://Assets/Sprites/arena-tileset.png" id="2_wnjm0"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://5k0o7d7j65a4" path="res://Assets/Sprites/arena-tileset-normal.png" id="3_iitgk"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dsr5kkbthpwpl" path="res://Characters/Doc.tscn" id="4_c0csw"]
|
||||||
|
[ext_resource type="Shader" path="res://Shaders/Flash.gdshader" id="5_aevwf"]
|
||||||
|
|
||||||
|
[sub_resource type="OccluderPolygon2D" id="OccluderPolygon2D_8jil2"]
|
||||||
|
polygon = PackedVector2Array(-8, -4, -6, -5, -6, -18, 6, -18, 6, -5, 8, -4, 8, 4, 4, 8, -4, 8, -8, 3.5)
|
||||||
|
|
||||||
|
[sub_resource type="CanvasTexture" id="CanvasTexture_dnsyd"]
|
||||||
|
diffuse_texture = ExtResource("2_wnjm0")
|
||||||
|
normal_texture = ExtResource("3_iitgk")
|
||||||
|
|
||||||
|
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_fcd6d"]
|
||||||
|
texture = SubResource("CanvasTexture_dnsyd")
|
||||||
|
0:0/0 = 0
|
||||||
|
0:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
0:0/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
1:0/0 = 0
|
||||||
|
1:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
1:0/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
2:0/0 = 0
|
||||||
|
2:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
2:0/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
3:0/0 = 0
|
||||||
|
3:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
3:0/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
4:0/0 = 0
|
||||||
|
4:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
4:0/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
4:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
5:0/0 = 0
|
||||||
|
5:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
5:0/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
5:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
6:0/0 = 0
|
||||||
|
6:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
6:0/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
7:0/size_in_atlas = Vector2i(1, 2)
|
||||||
|
7:0/0 = 0
|
||||||
|
7:0/0/texture_origin = Vector2i(0, 8)
|
||||||
|
7:0/0/occlusion_layer_0/polygon = SubResource("OccluderPolygon2D_8jil2")
|
||||||
|
7:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
7:0/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
7:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -4, 8, -4, 8, 3.5, 4.5, 8, -4, 8, -8, 4)
|
||||||
|
0:1/0 = 0
|
||||||
|
0:1/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
0:1/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
1:1/0 = 0
|
||||||
|
1:1/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
1:1/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
2:1/0 = 0
|
||||||
|
2:1/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
2:1/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
2:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
3:1/0 = 0
|
||||||
|
3:1/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
3:1/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
3:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
4:1/0 = 0
|
||||||
|
4:1/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
4:1/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
4:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
5:1/0 = 0
|
||||||
|
5:1/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
5:1/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
5:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
6:1/0 = 0
|
||||||
|
6:1/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
6:1/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
6:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
0:2/0 = 0
|
||||||
|
0:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
0:2/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
0:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
1:2/0 = 0
|
||||||
|
1:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
1:2/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
1:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
2:2/0 = 0
|
||||||
|
2:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
2:2/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
3:2/0 = 0
|
||||||
|
3:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
3:2/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
3:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
4:2/0 = 0
|
||||||
|
4:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
4:2/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
5:2/0 = 0
|
||||||
|
5:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
5:2/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
6:2/0 = 0
|
||||||
|
6:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
6:2/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
7:2/0 = 0
|
||||||
|
7:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
7:2/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
0:3/0 = 0
|
||||||
|
0:3/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
0:3/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
0:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
1:3/0 = 0
|
||||||
|
1:3/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
1:3/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
1:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
2:3/0 = 0
|
||||||
|
2:3/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
2:3/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
2:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
3:3/0 = 0
|
||||||
|
3:3/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
3:3/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
3:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
4:3/0 = 0
|
||||||
|
4:3/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
4:3/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
5:3/0 = 0
|
||||||
|
5:3/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
5:3/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
6:3/0 = 0
|
||||||
|
6:3/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
6:3/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
7:3/0 = 0
|
||||||
|
7:3/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
7:3/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
|
||||||
|
[sub_resource type="OccluderPolygon2D" id="OccluderPolygon2D_kbvre"]
|
||||||
|
polygon = PackedVector2Array(-4, 8, -8, 4, -8, -4, -6, -4, -6, -20, 6, -20, 6, -4, 8, -4, 8, 4, 4, 8)
|
||||||
|
|
||||||
|
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_5yxvt"]
|
||||||
|
texture = ExtResource("2_wnjm0")
|
||||||
|
0:0/0 = 0
|
||||||
|
0:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
0:0/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
1:0/0 = 0
|
||||||
|
1:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
1:0/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
2:0/0 = 0
|
||||||
|
2:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
2:0/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
3:0/0 = 0
|
||||||
|
3:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
3:0/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
4:0/0 = 0
|
||||||
|
4:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
4:0/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
4:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
5:0/0 = 0
|
||||||
|
5:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
5:0/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
5:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
6:0/0 = 0
|
||||||
|
6:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
6:0/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
0:1/0 = 0
|
||||||
|
0:1/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
0:1/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
1:1/0 = 0
|
||||||
|
1:1/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
1:1/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
2:1/0 = 0
|
||||||
|
2:1/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
2:1/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
2:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
3:1/0 = 0
|
||||||
|
3:1/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
3:1/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
3:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
4:1/0 = 0
|
||||||
|
4:1/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
4:1/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
4:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
5:1/0 = 0
|
||||||
|
5:1/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
5:1/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
5:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
6:1/0 = 0
|
||||||
|
6:1/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
6:1/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
6:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
0:2/0 = 0
|
||||||
|
0:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
0:2/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
0:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
1:2/0 = 0
|
||||||
|
1:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
1:2/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
1:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
2:2/0 = 0
|
||||||
|
2:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
2:2/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
3:2/0 = 0
|
||||||
|
3:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
3:2/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
3:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 0, -8, 0)
|
||||||
|
4:2/0 = 0
|
||||||
|
4:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
4:2/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
5:2/0 = 0
|
||||||
|
5:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
5:2/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
6:2/0 = 0
|
||||||
|
6:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
6:2/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
7:2/0 = 0
|
||||||
|
7:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
7:2/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
0:3/0 = 0
|
||||||
|
0:3/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
0:3/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
0:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
1:3/0 = 0
|
||||||
|
1:3/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
1:3/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
1:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
2:3/0 = 0
|
||||||
|
2:3/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
2:3/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
2:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 0, -8, 0, 8, -8, 8)
|
||||||
|
3:3/0 = 0
|
||||||
|
3:3/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
3:3/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
3:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(0, -8, 8, -8, 8, 8, 0, 8)
|
||||||
|
4:3/0 = 0
|
||||||
|
4:3/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
4:3/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
4:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(0, -8, 8, -8, 8, 0, 0, 0)
|
||||||
|
5:3/0 = 0
|
||||||
|
5:3/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
5:3/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
5:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 0, -8, 0, 0, -8, 0)
|
||||||
|
6:3/0 = 0
|
||||||
|
6:3/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
6:3/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
7:3/0 = 0
|
||||||
|
7:3/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
7:3/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
7:0/size_in_atlas = Vector2i(1, 2)
|
||||||
|
7:0/0 = 0
|
||||||
|
7:0/0/texture_origin = Vector2i(0, 8)
|
||||||
|
7:0/0/occlusion_layer_0/polygon = SubResource("OccluderPolygon2D_kbvre")
|
||||||
|
7:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
7:0/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
7:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
|
||||||
|
[sub_resource type="TileSet" id="TileSet_k1u48"]
|
||||||
|
occlusion_layer_0/light_mask = 1
|
||||||
|
physics_layer_0/collision_layer = 1
|
||||||
|
sources/2 = SubResource("TileSetAtlasSource_5yxvt")
|
||||||
|
sources/0 = SubResource("TileSetAtlasSource_fcd6d")
|
||||||
|
|
||||||
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_4g4ap"]
|
||||||
|
resource_local_to_scene = true
|
||||||
|
shader = ExtResource("5_aevwf")
|
||||||
|
shader_parameter/color = Quaternion(1, 1, 1, 1)
|
||||||
|
shader_parameter/intensity = 0.0
|
||||||
|
|
||||||
|
[node name="TileMap" instance=ExtResource("1_ifiic")]
|
||||||
|
tile_set = SubResource("TileSet_k1u48")
|
||||||
|
layer_0/tile_data = PackedInt32Array(-524281, 458752, 0, -524284, 458752, 0, -262152, 458752, 0, -327673, 458752, 0, -131065, 458752, 0, -65544, 458752, 0, 131064, 458752, 0, 65543, 458752, 0, 262151, 458752, 0, 327672, 458752, 0, 524280, 458752, 0, 524283, 458752, 0, 524286, 458752, 0, 458753, 458752, 0, 458756, 458752, 0, 458759, 458752, 0, -458760, 458752, 0, -458757, 458752, 0, -524287, 458752, 0, -458754, 458752, 0, -524292, 458752, 3, -589821, 458752, 2, -589822, 393216, 3, -524291, 393216, 2, -589817, 393216, 0)
|
||||||
|
layer_3/tile_data = PackedInt32Array(-196612, 65536, 1, -131076, 65536, 1, -65540, 196608, 0, -4, 131072, 0, -196611, 65536, 1, -131075, 65536, 0, -65539, 131072, 0, -3, 196608, 0, -196610, 65536, 0, -131074, 65536, 1, -65538, 0, 0, -2, 65536, 0, -196609, 65536, 1, -131073, 65536, 1, -65537, 65536, 0, -1, 65536, 1, -458760, 0, 0, -393224, 196608, 0, -327688, 196608, 0, -262152, 0, 0, -196616, 65536, 0, -131080, 131072, 0, -65544, 196608, 0, -8, 131072, 0, 65528, 131072, 0, 131064, 196608, 0, 196600, 131072, 0, 262136, 65536, 0, 327672, 65536, 0, 393208, 65536, 0, 458744, 0, 0, 524280, 65536, 0, -458759, 0, 1, -393223, 131072, 0, -327687, 131072, 0, -262151, 65536, 0, -196615, 65536, 1, -131079, 131072, 0, -65543, 131072, 0, -7, 196608, 0, 65529, 196608, 0, 131065, 196608, 0, 196601, 131072, 0, 262137, 65536, 1, 327673, 0, 0, 393209, 65536, 1, 458745, 65536, 0, 524281, 65536, 1, -458758, 0, 0, -393222, 65536, 0, -327686, 0, 0, -262150, 65536, 0, -196614, 0, 0, -131078, 0, 1, -65542, 196608, 0, -6, 196608, 0, 65530, 65536, 1, 131066, 65536, 1, 196602, 65536, 1, 262138, 0, 0, 327674, 65536, 1, 393210, 65536, 0, 458746, 131072, 0, 524282, 131072, 0, -458757, 65536, 0, -393221, 65536, 1, -327685, 65536, 0, -262149, 65536, 0, -196613, 0, 1, -131077, 0, 1, -65541, 131072, 0, -5, 131072, 0, 65531, 65536, 0, 131067, 0, 1, 196603, 0, 0, 262139, 0, 1, 327675, 0, 0, 393211, 65536, 0, 458747, 131072, 0, 524283, 196608, 0, -458756, 0, 0, -393220, 0, 1, -327684, 0, 0, -262148, 0, 0, 65532, 65536, 0, 131068, 65536, 0, 196604, 65536, 1, 262140, 0, 1, 327676, 131072, 0, 393212, 196608, 0, 458748, 196608, 0, 524284, 196608, 0, -458755, 0, 1, -393219, 0, 1, -327683, 0, 1, -262147, 0, 0, 65533, 65536, 0, 131069, 65536, 1, 196605, 65536, 1, 262141, 0, 1, 327677, 196608, 0, 393213, 131072, 0, 458749, 196608, 0, 524285, 131072, 0, -458754, 65536, 1, -393218, 65536, 1, -327682, 131072, 0, -262146, 196608, 0, 65534, 0, 1, 131070, 65536, 0, 196606, 196608, 0, 262142, 131072, 0, 327678, 196608, 0, 393214, 131072, 0, 458750, 65536, 0, 524286, 0, 0, -458753, 0, 1, -393217, 0, 1, -327681, 196608, 0, -262145, 131072, 0, 65535, 0, 1, 131071, 65536, 1, 196607, 131072, 0, 262143, 196608, 0, 327679, 131072, 0, 393215, 131072, 0, 458751, 65536, 1, 524287, 0, 0, -524288, 65536, 1, -458752, 65536, 1, -393216, 196608, 0, -327680, 196608, 0, -262144, 65536, 0, -196608, 0, 1, -131072, 65536, 0, -65536, 65536, 0, 0, 65536, 0, 65536, 65536, 1, 131072, 65536, 0, 196608, 65536, 1, 262144, 65536, 0, 327680, 0, 1, 393216, 0, 0, 458752, 0, 1, -524287, 65536, 1, -458751, 0, 0, -393215, 196608, 0, -327679, 196608, 0, -262143, 0, 0, -196607, 65536, 1, -131071, 0, 1, -65535, 65536, 1, 1, 0, 0, 65537, 65536, 1, 131073, 65536, 0, 196609, 65536, 0, 262145, 65536, 1, 327681, 65536, 1, 393217, 0, 1, 458753, 65536, 1, -524286, 65536, 0, -458750, 65536, 0, -393214, 131072, 0, -327678, 196608, 0, -262142, 0, 0, -196606, 65536, 0, -131070, 196608, 0, -65534, 131072, 0, 2, 131072, 0, 65538, 196608, 0, 131074, 65536, 0, 196610, 0, 0, 262146, 0, 1, 327682, 65536, 0, 393218, 131072, 0, 458754, 131072, 0, -524285, 65536, 0, -458749, 65536, 0, -393213, 131072, 0, -327677, 196608, 0, -262141, 0, 0, -196605, 65536, 0, -131069, 131072, 0, -65533, 131072, 0, 3, 196608, 0, 65539, 196608, 0, 131075, 0, 0, 196611, 0, 1, 262147, 65536, 1, 327683, 65536, 1, 393219, 196608, 0, 458755, 196608, 0, -524284, 0, 1, -458748, 65536, 0, -393212, 65536, 0, -327676, 0, 0, -262140, 65536, 1, -196604, 0, 1, -131068, 0, 1, -65532, 0, 1, 4, 0, 0, 65540, 65536, 1, 131076, 0, 0, 196612, 65536, 0, 262148, 131072, 0, 327684, 196608, 0, 393220, 196608, 0, 458756, 196608, 0, -524283, 65536, 1, -458747, 65536, 0, -393211, 65536, 1, -327675, 0, 0, -262139, 0, 1, -196603, 0, 1, -131067, 0, 1, -65531, 65536, 1, 5, 65536, 0, 65541, 65536, 0, 131077, 65536, 0, 196613, 0, 0, 262149, 196608, 0, 327685, 196608, 0, 393221, 131072, 0, 458757, 131072, 0, -524282, 0, 1, -458746, 0, 1, -393210, 0, 0, -327674, 65536, 0, -262138, 0, 0, -196602, 0, 1, -131066, 131072, 0, -65530, 196608, 0, 6, 65536, 0, 65542, 65536, 0, 131078, 0, 0, 196614, 0, 1, 262150, 65536, 0, 327686, 65536, 1, 393222, 0, 1, 458758, 0, 1, -524281, 65536, 0, -458745, 65536, 0, -393209, 196608, 0, -327673, 196608, 0, -262137, 196608, 0, -196601, 131072, 0, -131065, 196608, 0, -65529, 131072, 0, 7, 0, 1, 65543, 65536, 1, 131079, 0, 1, 196615, 0, 0, 262151, 0, 0, 327687, 0, 1, 393223, 65536, 0, 458759, 0, 1)
|
||||||
|
layer_4/tile_data = PackedInt32Array(-524296, 327680, 0, -589818, 262144, 0, -589817, 262144, 1, -589819, 327680, 0, -589820, 196608, 1, -589821, 327680, 1, -589822, 131072, 1, -589823, 262144, 1, -589824, 327680, 0, -524289, 131072, 1, -524290, 327680, 0, -524291, 327680, 1, -524292, 327680, 1, -524293, 327680, 0, -524294, 131072, 1, -524295, 262144, 1, -589832, 131072, 2, -589831, 131072, 2, -589830, 131072, 2, -589829, 131072, 2, -589828, 131072, 2, -589827, 131072, 2, -589826, 131072, 2, -589825, 131072, 2, -655360, 131072, 2, -655359, 131072, 2, -655358, 131072, 2, -655357, 131072, 2, -655356, 131072, 2, -655355, 131072, 2, -655354, 131072, 2, -655353, 131072, 2, -655352, 327680, 2, -589833, 262144, 2, -524297, 196608, 3, -458761, 196608, 3, -393225, 196608, 3, -327689, 196608, 3, -262153, 196608, 3, -196617, 196608, 3, -131081, 196608, 3, -65545, 196608, 3, -9, 196608, 3, 65527, 196608, 3, 131063, 196608, 3, 196599, 196608, 3, 262135, 196608, 3, 327671, 196608, 3, 393207, 196608, 3, 458743, 196608, 3, 524279, 196608, 3, 262152, 131072, 3, 327688, 131072, 3, 393224, 131072, 3, 458760, 131072, 3, 196616, 131072, 3, 131080, 131072, 3, 65544, 131072, 3, 8, 131072, 3, -65528, 131072, 3, -131064, 131072, 3, -196600, 131072, 3, -262136, 131072, 3, -589816, 131072, 3, -524280, 131072, 3, -458744, 131072, 3, -393208, 131072, 3, -327672, 131072, 3, 589816, 196608, 2, 589817, 196608, 2, 589818, 196608, 2, 589819, 196608, 2, 589820, 196608, 2, 589821, 196608, 2, 589822, 196608, 2, 589823, 196608, 2, 524288, 196608, 2, 524289, 196608, 2, 524290, 196608, 2, 524291, 196608, 2, 524292, 196608, 2, 524293, 196608, 2, 524294, 196608, 2, 524295, 196608, 2, 524296, 327680, 3, 589815, 262144, 3)
|
||||||
|
|
||||||
|
[node name="CanvasModulate" parent="." index="0"]
|
||||||
|
color = Color(0.753984, 0.753984, 0.753984, 1)
|
||||||
|
|
||||||
|
[node name="Doc" parent="Entities" index="0" instance=ExtResource("4_c0csw")]
|
||||||
|
material = SubResource("ShaderMaterial_4g4ap")
|
||||||
|
PreferredWeightDistance = 256.0
|
||||||
|
MaxWeightDistance = 32.0
|
File diff suppressed because one or more lines are too long
|
@ -46,6 +46,13 @@ public abstract partial class CharacterState : Node, IState<CharacterState>
|
||||||
|
|
||||||
public virtual CharacterState PhysicsProcess(double delta)
|
public virtual CharacterState PhysicsProcess(double delta)
|
||||||
{
|
{
|
||||||
|
if (Character.Health < 0)
|
||||||
|
{
|
||||||
|
Character.Velocity = Vector2.Zero;
|
||||||
|
Character.MoveAndSlide();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
Character.Velocity = Character.NetImpulse;
|
Character.Velocity = Character.NetImpulse;
|
||||||
|
|
||||||
if (Character.NetImpulse.LengthSquared() < Mathf.Pow(Character.Speed, 2))
|
if (Character.NetImpulse.LengthSquared() < Mathf.Pow(Character.Speed, 2))
|
||||||
|
|
|
@ -8,12 +8,28 @@ public partial class PlayerRollState : PlayerState
|
||||||
|
|
||||||
private Vector2 _rollDirection = Vector2.Zero;
|
private Vector2 _rollDirection = Vector2.Zero;
|
||||||
|
|
||||||
|
private AnimationPlayer _rollAnimation;
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
_rollAnimation = _player.GetNode<AnimationPlayer>("RollAnimation");
|
||||||
|
base._Ready();
|
||||||
|
}
|
||||||
|
|
||||||
public override IState<CharacterState> Enter(IState<CharacterState> previousState)
|
public override IState<CharacterState> Enter(IState<CharacterState> previousState)
|
||||||
{
|
{
|
||||||
_timeLeftToRoll = 0.5;
|
_timeLeftToRoll = 0.5;
|
||||||
// roll the direction we were previously moving in
|
// roll the direction we were previously moving in
|
||||||
_rollDirection = Character.Direction;
|
_rollDirection = Character.Direction;
|
||||||
Character.Target = Character.Direction;
|
Character.Target = Character.Direction;
|
||||||
|
if (Character.Direction.X >= 0)
|
||||||
|
{
|
||||||
|
_rollAnimation.Play("roll");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_rollAnimation.PlayBackwards("roll");
|
||||||
|
}
|
||||||
return base.Enter(previousState);
|
return base.Enter(previousState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,13 +39,14 @@ public partial class PlayerRollState : PlayerState
|
||||||
// this state (e.g. from death)
|
// this state (e.g. from death)
|
||||||
_timeLeftToRoll = 0;
|
_timeLeftToRoll = 0;
|
||||||
_rollDirection = Character.Direction;
|
_rollDirection = Character.Direction;
|
||||||
|
_rollAnimation.Stop();
|
||||||
base.Exit(nextState);
|
base.Exit(nextState);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override CharacterState Process(double delta)
|
public override CharacterState Process(double delta)
|
||||||
{
|
{
|
||||||
Character.Direction = _rollDirection;
|
Character.Direction = _rollDirection;
|
||||||
if ((_timeLeftToRoll -= delta) <= 0)
|
if ((_timeLeftToRoll -= delta) <= 0 || _player.Health <= 0)
|
||||||
{
|
{
|
||||||
return IdleState;
|
return IdleState;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,14 +13,26 @@ public abstract partial class PlayerState : CharacterState
|
||||||
public override CharacterState Input(InputEvent @event)
|
public override CharacterState Input(InputEvent @event)
|
||||||
{
|
{
|
||||||
var inventory = Character.Inventory;
|
var inventory = Character.Inventory;
|
||||||
|
var player = _player;
|
||||||
|
|
||||||
if (this is PlayerIdleState or PlayerMoveState &&
|
if (this is PlayerIdleState or PlayerMoveState &&
|
||||||
!_player.Inventory.IsUsingItem)
|
!player.Inventory.IsUsingItem)
|
||||||
{
|
{
|
||||||
if (@event.IsActionPressed("equip_1"))
|
if (@event.IsActionPressed("equip_1"))
|
||||||
{
|
{
|
||||||
inventory.SelectedItem = inventory.GetItemByMap("equip_1");
|
inventory.SelectedItem = inventory.GetItemByMap("equip_1");
|
||||||
}
|
}
|
||||||
|
else if (@event.IsActionPressed("equip_2"))
|
||||||
|
{
|
||||||
|
inventory.SelectedItem = inventory.GetItemByMap("equip_2");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (@event.IsActionPressed("interact"))
|
||||||
|
{
|
||||||
|
// if looking at a trigger then interact with it
|
||||||
|
GD.Print("interacting");
|
||||||
|
player.InteractionRay.Trigger?.InvokeInteraction();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.Input(@event);
|
return base.Input(@event);
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
namespace SupaLidlGame.State.Health;
|
||||||
|
|
||||||
|
public partial class AliveState : HealthState
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
namespace SupaLidlGame.State.Health;
|
|
@ -0,0 +1,13 @@
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace SupaLidlGame.State.Health;
|
||||||
|
|
||||||
|
public abstract partial class HealthState : Node, IState<HealthState>
|
||||||
|
{
|
||||||
|
public virtual IState<HealthState> Enter(IState<HealthState> prev) => null;
|
||||||
|
|
||||||
|
public virtual void Exit(IState<HealthState> next)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace SupaLidlGame.State.NPC.Doc;
|
||||||
|
|
||||||
|
public abstract partial class DocAttackState : NPCState
|
||||||
|
{
|
||||||
|
public abstract double Duration { get; set; }
|
||||||
|
|
||||||
|
public abstract double AttackDuration { get; set; }
|
||||||
|
|
||||||
|
public abstract PackedScene Projectile { get; set; }
|
||||||
|
|
||||||
|
public abstract DocChooseAttackState ChooseAttackState { get; set; }
|
||||||
|
|
||||||
|
protected abstract void Attack();
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
using Godot;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace SupaLidlGame.State.NPC.Doc;
|
||||||
|
|
||||||
|
public partial class DocChooseAttackState : NPCState
|
||||||
|
{
|
||||||
|
[Export]
|
||||||
|
public DocShungiteDartState DartState { get; set; }
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public DocShungiteSpikeState SpikeState { get; set; }
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public DocExitState ExitState { get; set; }
|
||||||
|
|
||||||
|
public Characters.Doc Doc => NPC as Characters.Doc;
|
||||||
|
|
||||||
|
private List<NPCState> _states = new List<NPCState>();
|
||||||
|
|
||||||
|
private int _consecutiveAttacks = 0;
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
_states.Add(DartState);
|
||||||
|
_states.Add(SpikeState);
|
||||||
|
base._Ready();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override NPCState Enter(IState<NPCState> previous)
|
||||||
|
{
|
||||||
|
if (previous is not DocTelegraphState)
|
||||||
|
{
|
||||||
|
_consecutiveAttacks++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_consecutiveAttacks = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_consecutiveAttacks > Doc.Intensity)
|
||||||
|
{
|
||||||
|
_consecutiveAttacks = 0;
|
||||||
|
return ExitState;
|
||||||
|
}
|
||||||
|
|
||||||
|
// choose random attack
|
||||||
|
var random = new System.Random();
|
||||||
|
return _states[random.Next(_states.Count)];
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace SupaLidlGame.State.NPC.Doc;
|
||||||
|
|
||||||
|
public partial class DocExitState : NPCState
|
||||||
|
{
|
||||||
|
[Export]
|
||||||
|
public AnimationPlayer TelegraphAnimationPlayer { get; set; }
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public DocTelegraphState TelegraphState { get; set; }
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public double Duration { get; set; } = 1;
|
||||||
|
|
||||||
|
private double _currentDuration = 0;
|
||||||
|
|
||||||
|
public override NPCState Enter(IState<NPCState> previousState)
|
||||||
|
{
|
||||||
|
_currentDuration = Duration;
|
||||||
|
TelegraphAnimationPlayer.Play("exit_out");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Exit(IState<NPCState> nextState)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override NPCState Process(double delta)
|
||||||
|
{
|
||||||
|
if ((_currentDuration -= delta) <= 0)
|
||||||
|
{
|
||||||
|
return TelegraphState;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,86 @@
|
||||||
|
using Godot;
|
||||||
|
using GodotUtilities;
|
||||||
|
using SupaLidlGame.Entities;
|
||||||
|
|
||||||
|
namespace SupaLidlGame.State.NPC.Doc;
|
||||||
|
|
||||||
|
public partial class DocShungiteDartState : DocAttackState
|
||||||
|
{
|
||||||
|
protected Scenes.Map _map;
|
||||||
|
protected Utils.World _world;
|
||||||
|
|
||||||
|
protected double _currentDuration = 0;
|
||||||
|
protected double _currentAttackDuration = 0;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public override double Duration { get; set; }
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public override double AttackDuration { get; set; }
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public override PackedScene Projectile { get; set; }
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public override DocChooseAttackState ChooseAttackState { get; set; }
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public Characters.Doc Doc { get; set; }
|
||||||
|
|
||||||
|
public override NPCState Enter(IState<NPCState> previousState)
|
||||||
|
{
|
||||||
|
_map = this.GetAncestor<Scenes.Map>();
|
||||||
|
_world = this.GetAncestor<Utils.World>();
|
||||||
|
_currentDuration = Duration;
|
||||||
|
_currentAttackDuration = AttackDuration;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Exit(IState<NPCState> nextState)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual Projectile SpawnProjectile(
|
||||||
|
Vector2 position,
|
||||||
|
Vector2 direction)
|
||||||
|
{
|
||||||
|
var projectile = _map.SpawnEntity<Projectile>(Projectile);
|
||||||
|
projectile.Hitbox.Faction = NPC.Faction;
|
||||||
|
// global position is (from npc to player) * 2 = (2 * npc) - player
|
||||||
|
//projectile.GlobalPosition = 2 * NPC.GlobalPosition - playerPos;
|
||||||
|
projectile.GlobalPosition = position;
|
||||||
|
projectile.Direction = direction;
|
||||||
|
projectile.GlobalRotation = direction.Angle();
|
||||||
|
projectile.Delay = 1.0 / Doc.Intensity;
|
||||||
|
return projectile;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Attack()
|
||||||
|
{
|
||||||
|
var player = _world.CurrentPlayer;
|
||||||
|
var playerPos = player.GlobalPosition;
|
||||||
|
Vector2 position1 = 2 * NPC.GlobalPosition - playerPos;
|
||||||
|
Vector2 position2 = 2 * playerPos - NPC.GlobalPosition;
|
||||||
|
Vector2 direction1 = position1.DirectionTo(playerPos);
|
||||||
|
Vector2 direction2 = -direction1;
|
||||||
|
SpawnProjectile(position1, direction1);
|
||||||
|
SpawnProjectile(position2, direction2);
|
||||||
|
_currentAttackDuration = AttackDuration / Doc.Intensity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override NPCState Process(double delta)
|
||||||
|
{
|
||||||
|
if ((_currentDuration -= delta) <= 0)
|
||||||
|
{
|
||||||
|
return ChooseAttackState;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((_currentAttackDuration -= delta) <= 0)
|
||||||
|
{
|
||||||
|
Attack();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
using Godot;
|
||||||
|
using SupaLidlGame.Entities;
|
||||||
|
|
||||||
|
namespace SupaLidlGame.State.NPC.Doc;
|
||||||
|
|
||||||
|
public partial class DocShungiteSpikeState : DocShungiteDartState
|
||||||
|
{
|
||||||
|
private float _intensity = 1;
|
||||||
|
|
||||||
|
public override NPCState Enter(IState<NPCState> previous)
|
||||||
|
{
|
||||||
|
// subtract from total state time by intensity
|
||||||
|
Duration = _currentDuration = 9 - 2 * Doc.Intensity;
|
||||||
|
return base.Enter(previous);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Projectile SpawnProjectile(
|
||||||
|
Vector2 position,
|
||||||
|
Vector2 direction)
|
||||||
|
{
|
||||||
|
var projectile = base.SpawnProjectile(position, direction)
|
||||||
|
as ShungiteSpike;
|
||||||
|
projectile.GlobalRotation = 0;
|
||||||
|
projectile.Delay = 0;
|
||||||
|
projectile.ExplodeTime = 6 - 2 * Doc.Intensity;
|
||||||
|
projectile.Hitbox.Faction = projectile.Hurtbox.Faction = Doc.Faction;
|
||||||
|
return projectile;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Attack()
|
||||||
|
{
|
||||||
|
var player = _world.CurrentPlayer;
|
||||||
|
var playerPos = player.GlobalPosition;
|
||||||
|
Vector2 left = playerPos + Vector2.Left * 64;
|
||||||
|
Vector2 right = playerPos + Vector2.Right * 64;
|
||||||
|
Vector2 up = playerPos + Vector2.Up * 64;
|
||||||
|
Vector2 down = playerPos + Vector2.Down * 64;
|
||||||
|
SpawnProjectile(left, Vector2.Zero);
|
||||||
|
SpawnProjectile(right, Vector2.Zero);
|
||||||
|
SpawnProjectile(up, Vector2.Zero);
|
||||||
|
SpawnProjectile(down, Vector2.Zero);
|
||||||
|
|
||||||
|
// only attack once and stop (but keep in this state for 8 seconds)
|
||||||
|
_currentAttackDuration += 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override NPCState Process(double delta)
|
||||||
|
{
|
||||||
|
if ((_currentDuration -= delta) <= 0)
|
||||||
|
{
|
||||||
|
return ChooseAttackState;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((_currentAttackDuration -= delta) <= 0)
|
||||||
|
{
|
||||||
|
Attack();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace SupaLidlGame.State.NPC.Doc;
|
||||||
|
|
||||||
|
public partial class DocTelegraphState : NPCState
|
||||||
|
{
|
||||||
|
[Export]
|
||||||
|
public AnimationPlayer TelegraphAnimationPlayer { get; set; }
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public DocChooseAttackState AttackState { get; set; }
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public double Duration { get; set; } = 1;
|
||||||
|
|
||||||
|
private double _currentDuration = 1;
|
||||||
|
|
||||||
|
public override NPCState Enter(IState<NPCState> previousState)
|
||||||
|
{
|
||||||
|
_currentDuration = Duration;
|
||||||
|
TelegraphAnimationPlayer.Play("enter_in");
|
||||||
|
float randX = GD.RandRange(-128, 128);
|
||||||
|
float randY = GD.RandRange(-128, 128);
|
||||||
|
NPC.GlobalPosition = new Vector2(randX, randY);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Exit(IState<NPCState> nextState)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override NPCState Process(double delta)
|
||||||
|
{
|
||||||
|
if ((_currentDuration -= delta) <= 0)
|
||||||
|
{
|
||||||
|
return AttackState;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace SupaLidlGame.State.NPC;
|
||||||
|
|
||||||
|
public abstract partial class NPCState : Node, IState<NPCState>
|
||||||
|
{
|
||||||
|
[Export]
|
||||||
|
public SupaLidlGame.Characters.NPC NPC { get; set; }
|
||||||
|
|
||||||
|
public abstract IState<NPCState> Enter(IState<NPCState> previousState);
|
||||||
|
|
||||||
|
public virtual void Exit(IState<NPCState> nextState)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual IState<NPCState> Process(double delta) => null;
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace SupaLidlGame.State.NPC;
|
||||||
|
|
||||||
|
public partial class NPCStateMachine : StateMachine<NPCState>
|
||||||
|
{
|
||||||
|
[Export]
|
||||||
|
public override NPCState InitialState { get; set; }
|
||||||
|
|
||||||
|
public void Process(double delta)
|
||||||
|
{
|
||||||
|
var state = CurrentState.Process(delta);
|
||||||
|
if (state is NPCState s)
|
||||||
|
{
|
||||||
|
ChangeState(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace SupaLidlGame.State.NPC;
|
||||||
|
|
||||||
|
public partial class NPCTelegraphState : NPCState
|
||||||
|
{
|
||||||
|
[Export]
|
||||||
|
public double Duration { get; set; }
|
||||||
|
|
||||||
|
public override NPCState Enter(IState<NPCState> previousState)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Exit(IState<NPCState> nextState)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,4 +3,7 @@
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<EnableDynamicLoading>true</EnableDynamicLoading>
|
<EnableDynamicLoading>true</EnableDynamicLoading>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Firebelley.GodotUtilities" Version="4.0.4" />
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -1,6 +1,6 @@
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 2012
|
# Visual Studio 2012
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SupaLidlGame", "SupaLidlGame.csproj", "{AF3A4D72-D276-44C3-A64F-EAB32D2B9B97}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SupaLidlGame", "SupaLidlGame.csproj", "{BC071CA6-9462-4CEC-AA20-B0CA618321E5}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
@ -9,11 +9,11 @@ Global
|
||||||
ExportRelease|Any CPU = ExportRelease|Any CPU
|
ExportRelease|Any CPU = ExportRelease|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{AF3A4D72-D276-44C3-A64F-EAB32D2B9B97}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{BC071CA6-9462-4CEC-AA20-B0CA618321E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{AF3A4D72-D276-44C3-A64F-EAB32D2B9B97}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{BC071CA6-9462-4CEC-AA20-B0CA618321E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{AF3A4D72-D276-44C3-A64F-EAB32D2B9B97}.ExportDebug|Any CPU.ActiveCfg = ExportDebug|Any CPU
|
{BC071CA6-9462-4CEC-AA20-B0CA618321E5}.ExportDebug|Any CPU.ActiveCfg = ExportDebug|Any CPU
|
||||||
{AF3A4D72-D276-44C3-A64F-EAB32D2B9B97}.ExportDebug|Any CPU.Build.0 = ExportDebug|Any CPU
|
{BC071CA6-9462-4CEC-AA20-B0CA618321E5}.ExportDebug|Any CPU.Build.0 = ExportDebug|Any CPU
|
||||||
{AF3A4D72-D276-44C3-A64F-EAB32D2B9B97}.ExportRelease|Any CPU.ActiveCfg = ExportRelease|Any CPU
|
{BC071CA6-9462-4CEC-AA20-B0CA618321E5}.ExportRelease|Any CPU.ActiveCfg = ExportRelease|Any CPU
|
||||||
{AF3A4D72-D276-44C3-A64F-EAB32D2B9B97}.ExportRelease|Any CPU.Build.0 = ExportRelease|Any CPU
|
{BC071CA6-9462-4CEC-AA20-B0CA618321E5}.ExportRelease|Any CPU.Build.0 = ExportRelease|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace SupaLidlGame.Utils;
|
||||||
|
|
||||||
|
public partial class DamageTime : Node
|
||||||
|
{
|
||||||
|
private double _duration = 0.1;
|
||||||
|
|
||||||
|
private double _currentDuration = 0;
|
||||||
|
|
||||||
|
private double _startValue = 0;
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
if (GetParent() is Characters.Player player)
|
||||||
|
{
|
||||||
|
player.Hurt += PlayerHurt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PlayerHurt(Events.HealthChangedArgs args)
|
||||||
|
{
|
||||||
|
if (args.Damage > 10)
|
||||||
|
{
|
||||||
|
// temp
|
||||||
|
//float strength = 0.8f;
|
||||||
|
//_startValue = 1 - strength;
|
||||||
|
//_currentDuration = 0;
|
||||||
|
_currentDuration = _duration;
|
||||||
|
Engine.TimeScale = 0.1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void _Process(double delta)
|
||||||
|
{
|
||||||
|
if ((_currentDuration -= delta) < 0)
|
||||||
|
{
|
||||||
|
Engine.TimeScale = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
namespace SupaLidlGame.Utils;
|
||||||
|
|
||||||
|
public interface IInteractive
|
||||||
|
{
|
||||||
|
public BoundingBoxes.InteractionTrigger InteractionTrigger { get; set; }
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
using Godot;
|
using Godot;
|
||||||
using Godot.Collections;
|
using Godot.Collections;
|
||||||
|
using GodotUtilities;
|
||||||
using SupaLidlGame.Extensions;
|
using SupaLidlGame.Extensions;
|
||||||
|
|
||||||
namespace SupaLidlGame.Utils;
|
namespace SupaLidlGame.Utils;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
using Godot;
|
using Godot;
|
||||||
using SupaLidlGame.Characters;
|
using SupaLidlGame.Characters;
|
||||||
using SupaLidlGame.Scenes;
|
using SupaLidlGame.Scenes;
|
||||||
using SupaLidlGame.Extensions;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
|
@ -24,6 +23,10 @@ public partial class World : Node2D
|
||||||
|
|
||||||
private string _currentMapResourcePath;
|
private string _currentMapResourcePath;
|
||||||
|
|
||||||
|
//private Entities.Campfire _lastCampfire = null;
|
||||||
|
public Vector2 SaveLocation { get; set; }
|
||||||
|
public string SaveMapKey { get; set; }
|
||||||
|
|
||||||
private const string PLAYER_PATH = "res://Characters/Player.tscn";
|
private const string PLAYER_PATH = "res://Characters/Player.tscn";
|
||||||
private PackedScene _playerScene;
|
private PackedScene _playerScene;
|
||||||
|
|
||||||
|
@ -43,23 +46,21 @@ public partial class World : Node2D
|
||||||
// spawn the player in
|
// spawn the player in
|
||||||
CreatePlayer();
|
CreatePlayer();
|
||||||
|
|
||||||
|
CurrentPlayer.Death += (Events.HealthChangedArgs args) =>
|
||||||
|
{
|
||||||
|
// TODO: respawn the player at the last campfire.
|
||||||
|
GetTree().CreateTimer(1).Timeout += () =>
|
||||||
|
{
|
||||||
|
SpawnPlayer();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
base._Ready();
|
base._Ready();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadScene(PackedScene scene)
|
private void LoadMap(Map map)
|
||||||
{
|
{
|
||||||
GD.Print("Loading map " + scene.ResourcePath);
|
GD.Print("Loading map " + map.Name);
|
||||||
|
|
||||||
Map map;
|
|
||||||
if (_maps.ContainsKey(scene.ResourcePath))
|
|
||||||
{
|
|
||||||
map = _maps[scene.ResourcePath];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
map = scene.Instantiate<Map>();
|
|
||||||
_maps.Add(scene.ResourcePath, map);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CurrentMap is not null)
|
if (CurrentMap is not null)
|
||||||
{
|
{
|
||||||
|
@ -80,6 +81,39 @@ public partial class World : Node2D
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void LoadScene(PackedScene scene)
|
||||||
|
{
|
||||||
|
Map map;
|
||||||
|
if (_maps.ContainsKey(scene.ResourcePath))
|
||||||
|
{
|
||||||
|
map = _maps[scene.ResourcePath];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
map = scene.Instantiate<Map>();
|
||||||
|
_maps.Add(scene.ResourcePath, map);
|
||||||
|
}
|
||||||
|
|
||||||
|
LoadMap(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadScene(string path)
|
||||||
|
{
|
||||||
|
Map map;
|
||||||
|
if (_maps.ContainsKey(path))
|
||||||
|
{
|
||||||
|
map = _maps[path];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var scene = ResourceLoader.Load<PackedScene>(path);
|
||||||
|
map = scene.Instantiate<Map>();
|
||||||
|
_maps.Add(scene.ResourcePath, map);
|
||||||
|
}
|
||||||
|
|
||||||
|
LoadMap(map);
|
||||||
|
}
|
||||||
|
|
||||||
public void CreatePlayer()
|
public void CreatePlayer()
|
||||||
{
|
{
|
||||||
CurrentPlayer = _playerScene.Instantiate<Player>();
|
CurrentPlayer = _playerScene.Instantiate<Player>();
|
||||||
|
@ -146,4 +180,36 @@ public partial class World : Node2D
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
throw new System.NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the player's saved spawn position.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="position">The position to save and spawn the player in</param>
|
||||||
|
/// <param name="mapKey">
|
||||||
|
/// The map to spawn the player in. If <see langword="null" />, use the
|
||||||
|
/// <c>World</c>'s <c>CurrentMap</c>
|
||||||
|
/// </param>
|
||||||
|
public void SetSpawn(Vector2 position, string mapKey = null)
|
||||||
|
{
|
||||||
|
GD.Print("Set spawn");
|
||||||
|
if (mapKey is null)
|
||||||
|
{
|
||||||
|
mapKey = CurrentMap.SceneFilePath;
|
||||||
|
SaveLocation = position;
|
||||||
|
SaveMapKey = mapKey;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SpawnPlayer()
|
||||||
|
{
|
||||||
|
// TODO: add max health property
|
||||||
|
//CurrentPlayer.Health = 100;
|
||||||
|
//CurrentPlayer.Sprite.Visible = true;
|
||||||
|
if (CurrentMap.SceneFilePath != SaveMapKey)
|
||||||
|
{
|
||||||
|
LoadScene(SaveMapKey);
|
||||||
|
}
|
||||||
|
CurrentPlayer.GlobalPosition = SaveLocation;
|
||||||
|
CurrentPlayer.Spawn();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,13 @@ equip_3={
|
||||||
2d_physics/layer_3="Player"
|
2d_physics/layer_3="Player"
|
||||||
2d_physics/layer_4="NPC"
|
2d_physics/layer_4="NPC"
|
||||||
2d_physics/layer_5="World Clip"
|
2d_physics/layer_5="World Clip"
|
||||||
|
2d_physics/layer_6="Interaction Receiver"
|
||||||
|
2d_physics/layer_7="Interaction Trigger"
|
||||||
|
|
||||||
[physics]
|
[physics]
|
||||||
|
|
||||||
2d/default_gravity=0.0
|
2d/default_gravity=0.0
|
||||||
|
|
||||||
|
[rendering]
|
||||||
|
|
||||||
|
environment/defaults/default_clear_color=Color(0.301961, 0.301961, 0.301961, 1)
|
||||||
|
|
Loading…
Reference in New Issue