Compare commits

..

2 Commits

Author SHA1 Message Date
8143da44db Not perfect but enemies move/attack with animation 2024-09-15 23:56:05 -07:00
4a1fdd94f8 Hit shader 2024-09-15 17:12:18 -07:00
44 changed files with 1126 additions and 471 deletions

View File

@@ -1,44 +1,4 @@
[gd_resource type="ShaderMaterial" load_steps=2 format=3 uid="uid://pq2fqq4ophsy"] [gd_resource type="ShaderMaterial" format=3 uid="uid://pq2fqq4ophsy"]
[sub_resource type="Shader" id="Shader_xtf8b"]
resource_local_to_scene = true
code = "shader_type spatial;
render_mode unshaded, cull_disabled, depth_draw_always, depth_test_disabled;
uniform vec3 color = vec3(0.0, 1.0, 0.0);
uniform float line_width : hint_range(0.0, 10.0) = 0.85;
varying vec3 barycentric;
void vertex() {
vec3 b_coords[3] = vec3[](vec3(1, 0, 0), vec3(0, 1, 0), vec3(0, 0, 1));
int vertex_id = int(VERTEX_ID) % 3;
barycentric = b_coords[vertex_id];
}
void fragment() {
// Calculate the screen-space derivatives of the barycentric coordinates
vec3 dFdx_barycentric = dFdx(barycentric);
vec3 dFdy_barycentric = dFdy(barycentric);
// Calculate the minimum barycentric coordinate value
float min_bary = min(min(barycentric.x, barycentric.y), barycentric.z);
// Calculate the screen-space line width
float screen_line_width = line_width * length(vec2(dFdx_barycentric.x, dFdy_barycentric.x));
// Draw the line based on the calculated screen-space line width
if (min_bary < screen_line_width) {
ALBEDO = color;
} else {
discard;
}
}
"
[resource] [resource]
resource_local_to_scene = true resource_local_to_scene = true
render_priority = 0
shader = SubResource("Shader_xtf8b")
shader_parameter/color = Vector3(0, 1, 0)
shader_parameter/line_width = 0.85

View File

@@ -1,10 +0,0 @@
using Godot;
using System;
public partial class Camera3d : Node3D
{
public override void _Process(double delta)
{
this.RotateY((float)delta);
}
}

View File

@@ -1,31 +0,0 @@
[gd_scene load_steps=5 format=3 uid="uid://ccnks05btp3f1"]
[ext_resource type="PackedScene" uid="uid://dcgj5i52i76gj" path="res://src/enemy/enemy_types/michael/Michael.tscn" id="1_1iqeh"]
[ext_resource type="Script" path="res://src/enemy/enemy_types/michael/RotationTest.cs" id="2_c7eon"]
[ext_resource type="Script" path="res://dungeon_test/Camera3d.cs" id="3_ddadm"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_4ork2"]
albedo_color = Color(0.282353, 0.172549, 0.521569, 1)
[node name="Node3D" type="Node3D"]
[node name="Michael" parent="." instance=ExtResource("1_1iqeh")]
script = ExtResource("2_c7eon")
[node name="CurrentFrameLabel" type="Label" parent="Michael"]
unique_name_in_owner = true
offset_left = 467.0
offset_top = 71.0
offset_right = 1081.0
offset_bottom = 291.0
[node name="CSGBox3D" type="CSGBox3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.962679, 0)
material_override = SubResource("StandardMaterial3D_4ork2")
[node name="CamBase" type="Node3D" parent="."]
script = ExtResource("3_ddadm")
[node name="TestCamera" type="Camera3D" parent="CamBase"]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.357711, 2.14968)

View File

@@ -1,9 +0,0 @@
[gd_scene format=3 uid="uid://b8n8hbe4kdyfw"]
[node name="DialogueTest" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2

View File

@@ -34,6 +34,8 @@ public partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLogic>
[Dependency] IGameRepo GameRepo => this.DependOn<IGameRepo>(); [Dependency] IGameRepo GameRepo => this.DependOn<IGameRepo>();
[Dependency] IGameEventDepot GameEventDepot => this.DependOn<IGameEventDepot>();
[Export] [Export]
public EnemyStatResource EnemyStatResource { get; set; } = default!; public EnemyStatResource EnemyStatResource { get; set; } = default!;
@@ -51,10 +53,12 @@ public partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLogic>
[Node] public Timer AttackTimer { get; set; } = default!; [Node] public Timer AttackTimer { get; set; } = default!;
[Node] public AnimatedSprite3D AnimatedSprite { get; set; } = default!; [Node] public AnimatedSprite2D AnimatedSprite { get; set; } = default!;
[Node] public RayCast3D Raycast { get; set; } = default!; [Node] public RayCast3D Raycast { get; set; } = default!;
[Node] public AnimationPlayer AnimationPlayer { get; set; } = default!;
private const string IDLE_FORWARD = "idle_front_walk"; private const string IDLE_FORWARD = "idle_front_walk";
private const string IDLE_LEFT = "idle_left_walk"; private const string IDLE_LEFT = "idle_left_walk";
private const string IDLE_BACK = "idle_back_walk"; private const string IDLE_BACK = "idle_back_walk";
@@ -67,45 +71,15 @@ public partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLogic>
EnemyLogic.Set(EnemyStatResource); EnemyLogic.Set(EnemyStatResource);
EnemyLogic.Set(this as IEnemy); EnemyLogic.Set(this as IEnemy);
EnemyLogic.Set(GameRepo); EnemyLogic.Set(GameRepo);
AnimationPlayer.AnimationFinished += AnimationPlayer_AnimationFinished;
} }
private void OnPatrolTimeout() public void OnReady()
{ {
var rng = new RandomNumberGenerator(); SetPhysicsProcess(true);
rng.Randomize(); CollisionDetector = CollisionDetectorScene.Instantiate<Area3D>();
var randomizedSpot = new Vector3(rng.RandfRange(-3.0f, 3.0f), 0, rng.RandfRange(-3.0f, 3.0f)); CollisionDetector.AreaEntered += OnPlayerHitboxEntered;
EnemyLogic.Input(new EnemyLogic.Input.PatrolToRandomSpot(GlobalPosition + randomizedSpot)); AddChild(CollisionDetector);
PatrolTimer.WaitTime = rng.RandfRange(7.0f, 15.0f);
}
private void OnAttackTimeout()
{
if (GlobalPosition.DistanceTo(GameRepo.PlayerGlobalPosition.Value) > 2.5f)
return;
var rng = new RandomNumberGenerator();
rng.Randomize();
EnemyLogic.Input(new EnemyLogic.Input.AttackTimer());
AttackTimer.WaitTime = rng.RandfRange(2f, 3.0f);
}
private void LineOfSight_BodyEntered(Node3D body)
{
var overlappingBodies = LineOfSight.GetOverlappingBodies();
//foreach (var overlap in overlappingBodies)
//{
// Raycast.LookAt(GameRepo.PlayerGlobalPosition.Value, Vector3.Up);
// Raycast.ForceRaycastUpdate();
// if (Raycast.IsColliding())
// {
// var collider = Raycast.GetCollider();
// if (collider is IPlayer player)
// {
// Raycast.DebugShapeCustomColor = Color.FromString("Purple", Colors.Purple);
// EnemyLogic.Input(new EnemyLogic.Input.Alerted());
// }
// }
//}
} }
public void OnResolved() public void OnResolved()
@@ -115,17 +89,25 @@ public partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLogic>
EnemyBinding EnemyBinding
.Handle((in EnemyLogic.Output.MovementComputed output) => .Handle((in EnemyLogic.Output.MovementComputed output) =>
{ {
if (AnimationPlayer.CurrentAnimation != "hit" && AnimationPlayer.CurrentAnimation != "attack")
RotateEnemy(-GameRepo.PlayerGlobalTransform.Value.Basis.Z);
MoveAndSlide(); MoveAndSlide();
}) })
.Handle((in EnemyLogic.Output.Die output) =>
{
QueueFree();
})
.Handle((in EnemyLogic.Output.HitByPlayer output) => .Handle((in EnemyLogic.Output.HitByPlayer output) =>
{ {
AnimationPlayer.Stop();
AnimationPlayer.Play("hit");
// TODO: Make this an event to notify game that player hit someone // TODO: Make this an event to notify game that player hit someone
if (GameRepo.PlayerData.Inventory.EquippedWeapon.Value.WeaponStats.WeaponTags.Contains(WeaponTag.SelfDamage)) if (GameRepo.PlayerData.Inventory.EquippedWeapon.Value.WeaponStats.WeaponTags.Contains(WeaponTag.SelfDamage))
GameRepo.PlayerData.SetCurrentHP(GameRepo.PlayerData.CurrentHP.Value - 5); GameRepo.PlayerData.SetCurrentHP(GameRepo.PlayerData.CurrentHP.Value - 5);
})
.Handle((in EnemyLogic.Output.Attack _) =>
{
AnimationPlayer.Play("attack");
})
.Handle((in EnemyLogic.Output.Defeated output) =>
{
AnimationPlayer.Play("defeated");
}); });
this.Provide(); this.Provide();
@@ -142,37 +124,24 @@ public partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLogic>
PatrolTimer.WaitTime = rng.RandfRange(7.0f, 15.0f); PatrolTimer.WaitTime = rng.RandfRange(7.0f, 15.0f);
} }
private void RotateEnemy(Vector3 cameraDirection) public void OnExitTree()
{ {
var rotateUpperThreshold = 0.85f; EnemyLogic.Stop();
var rotateLowerThreshold = 0.3f; EnemyBinding.Dispose();
}
var enemyForwardDirection = GlobalTransform.Basis.Z; private void OnPatrolTimeout()
var enemyLeftDirection = GlobalTransform.Basis.X; {
var rng = new RandomNumberGenerator();
var leftDotProduct = enemyLeftDirection.Dot(cameraDirection); rng.Randomize();
var forwardDotProduct = enemyForwardDirection.Dot(cameraDirection); var randomizedSpot = new Vector3(rng.RandfRange(-7.0f, 7.0f), 0, rng.RandfRange(-7.0f, 7.0f));
EnemyLogic.Input(new EnemyLogic.Input.PatrolToRandomSpot(GlobalPosition + randomizedSpot));
// Check if forward facing. If the dot product is -1, the enemy is facing the camera. PatrolTimer.WaitTime = rng.RandfRange(1.0f, 3.0f);
if (forwardDotProduct < -rotateUpperThreshold)
AnimatedSprite.Play("idle_front_walk");
// Check if backward facing. If the dot product is 1, the enemy is facing the same direction as the camera.
else if (forwardDotProduct > rotateUpperThreshold)
AnimatedSprite.Play("idle_back_walk");
else
{
// If the dot product of the perpendicular dot product is positive (up to 1), the enemy is facing to the left (since it's mirrored).
AnimatedSprite.FlipH = leftDotProduct > 0;
// Check is side facing. If the dot product is close to zero in the positive or negative direction, its close to the threshold for turning.
if (Mathf.Abs(forwardDotProduct) < rotateLowerThreshold)
AnimatedSprite.Play("idle_left_walk");
}
} }
public void OnPhysicsProcess(double delta) public void OnPhysicsProcess(double delta)
{ {
EnemyLogic.Input(new EnemyLogic.Input.PhysicsTick(delta)); EnemyLogic.Input(new EnemyLogic.Input.PhysicsTick(delta));
RotateEnemy(-GameRepo.PlayerGlobalTransform.Value.Basis.Z);
} }
public void OnPlayerHitboxEntered(Area3D body) public void OnPlayerHitboxEntered(Area3D body)
@@ -194,33 +163,75 @@ public partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLogic>
} }
} }
private void OnAttackTimeout()
{
if (GlobalPosition.DistanceTo(GameRepo.PlayerGlobalPosition.Value) > 2.5f)
return;
var rng = new RandomNumberGenerator();
rng.Randomize();
EnemyLogic.Input(new EnemyLogic.Input.AttackTimer());
AttackTimer.WaitTime = rng.RandfRange(2f, 3.0f);
}
private void LineOfSight_BodyEntered(Node3D body)
{
var overlappingBodies = LineOfSight.GetOverlappingBodies();
foreach (var overlap in overlappingBodies)
{
Raycast.LookAt(GameRepo.PlayerGlobalPosition.Value, Vector3.Up);
Raycast.ForceRaycastUpdate();
if (Raycast.IsColliding())
{
var collider = Raycast.GetCollider();
if (collider is IPlayer player)
{
Raycast.DebugShapeCustomColor = Color.FromString("Purple", Colors.Purple);
EnemyLogic.Input(new EnemyLogic.Input.Alerted());
}
}
}
}
private void RotateEnemy(Vector3 cameraDirection)
{
var rotateUpperThreshold = 0.85f;
var rotateLowerThreshold = 0.3f;
var enemyForwardDirection = GlobalTransform.Basis.Z;
var enemyLeftDirection = GlobalTransform.Basis.X;
var leftDotProduct = enemyLeftDirection.Dot(cameraDirection);
var forwardDotProduct = enemyForwardDirection.Dot(cameraDirection);
// Check if forward facing. If the dot product is -1, the enemy is facing the camera.
if (forwardDotProduct < -rotateUpperThreshold)
AnimationPlayer.Play("idle_front_walk");
// Check if backward facing. If the dot product is 1, the enemy is facing the same direction as the camera.
else if (forwardDotProduct > rotateUpperThreshold)
AnimationPlayer.Play("idle_back_walk");
else
{
// If the dot product of the perpendicular dot product is positive (up to 1), the enemy is facing to the left (since it's mirrored).
AnimatedSprite.FlipH = leftDotProduct > 0;
// Check is side facing. If the dot product is close to zero in the positive or negative direction, its close to the threshold for turning.
if (Mathf.Abs(forwardDotProduct) < rotateLowerThreshold)
AnimationPlayer.Play("idle_left_walk");
}
}
private void OnHPChanged(double newHP) private void OnHPChanged(double newHP)
{ {
if (newHP <= 0) if (newHP <= 0)
{ {
EnemyLogic.Input(new EnemyLogic.Input.Killed()); EnemyLogic.Input(new EnemyLogic.Input.EnemyDefeated());
GameEventDepot.OnEnemyDefeated(EnemyStatResource);
} }
} }
public void OnReady() private void AnimationPlayer_AnimationFinished(StringName animName)
{ {
SetPhysicsProcess(true); if (animName == "defeated")
CollisionDetector = CollisionDetectorScene.Instantiate<Area3D>(); QueueFree();
CollisionDetector.AreaEntered += OnPlayerHitboxEntered;
AddChild(CollisionDetector);
}
public void OnExitTree()
{
EnemyLogic.Stop();
EnemyBinding.Dispose();
} }
} }
public enum WeaponTag
{
SelfDamage,
IgnoreAffinity,
Knockback,
BreaksOnChange
}

View File

@@ -1,7 +1,7 @@
[gd_scene load_steps=3 format=3 uid="uid://dbvr8ewajja6a"] [gd_scene load_steps=3 format=3 uid="uid://dbvr8ewajja6a"]
[ext_resource type="Script" path="res://src/enemy/EnemyDatabase.cs" id="1_ywy58"] [ext_resource type="Script" path="res://src/enemy/EnemyDatabase.cs" id="1_ywy58"]
[ext_resource type="PackedScene" uid="uid://dcgj5i52i76gj" path="res://src/enemy/enemy_types/michael/Michael.tscn" id="2_8cbrh"] [ext_resource type="PackedScene" uid="uid://dcgj5i52i76gj" path="res://src/enemy/enemy_types/BaseEnemy.tscn" id="2_8cbrh"]
[node name="EnemyDatabase" type="Node"] [node name="EnemyDatabase" type="Node"]
script = ExtResource("1_ywy58") script = ExtResource("1_ywy58")

9
src/enemy/WeaponTag.cs Normal file
View File

@@ -0,0 +1,9 @@
namespace GameJamDungeon;
public enum WeaponTag
{
SelfDamage,
IgnoreAffinity,
Knockback,
BreaksOnChange
}

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,90 @@
[gd_scene load_steps=8 format=3 uid="uid://dcgj5i52i76gj"]
[ext_resource type="Script" path="res://src/enemy/Enemy.cs" id="1_e15u8"]
[ext_resource type="Script" path="res://src/enemy/EnemyStatResource.cs" id="2_7jlxu"]
[ext_resource type="Script" path="res://src/hitbox/Hitbox.cs" id="6_3xvg5"]
[sub_resource type="Resource" id="Resource_rxw8v"]
script = ExtResource("2_7jlxu")
CurrentHP = 45.0
MaximumHP = 45.0
CurrentAttack = 3
CurrentDefense = 2
MaxAttack = 3
MaxDefense = 2
Luck = 0.05
TelluricResistance = null
AeolicResistance = null
HydricResistance = null
IgneousResistance = null
FerrumResistance = null
TelluricDamageBonus = null
AeolicDamageBonus = null
BaseHydricDamageBonus = null
IgneousDamageBonus = null
FerrumDamageBonus = null
[sub_resource type="CylinderShape3D" id="CylinderShape3D_jbgmx"]
height = 3.0
radius = 1.0
[sub_resource type="BoxShape3D" id="BoxShape3D_0yire"]
size = Vector3(1, 0.564941, 1.14453)
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_cwfph"]
height = 1.0
[node name="BaseEnemy" type="CharacterBody3D"]
process_mode = 1
collision_layer = 10
collision_mask = 11
axis_lock_linear_y = true
script = ExtResource("1_e15u8")
EnemyStatResource = SubResource("Resource_rxw8v")
[node name="LineOfSight" type="Area3D" parent="."]
unique_name_in_owner = true
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0)
collision_layer = 2
collision_mask = 2
[node name="CollisionShape3D" type="CollisionShape3D" parent="LineOfSight"]
transform = Transform3D(1, 0, 0, 0, 0.0745088, 0.99722, 0, -0.99722, 0.0745088, 0, 0, -1.46944)
shape = SubResource("CylinderShape3D_jbgmx")
[node name="PatrolTimer" type="Timer" parent="."]
unique_name_in_owner = true
wait_time = 10.0
autostart = true
[node name="AttackTimer" type="Timer" parent="."]
unique_name_in_owner = true
wait_time = 1.8
autostart = true
[node name="Hitbox" type="Area3D" parent="."]
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, -0.152949, 0, 0)
collision_layer = 64
collision_mask = 64
script = ExtResource("6_3xvg5")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Hitbox"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.189337, 0.217529, -0.78415)
shape = SubResource("BoxShape3D_0yire")
disabled = true
[node name="Raycast" type="RayCast3D" parent="."]
unique_name_in_owner = true
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0)
target_position = Vector3(0, 0, -3)
collision_mask = 3
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0)
shape = SubResource("CapsuleShape3D_cwfph")
[node name="NavAgent" type="NavigationAgent3D" parent="."]
unique_name_in_owner = true
avoidance_enabled = true
debug_enabled = true
debug_path_custom_color = Color(1, 0, 0, 1)

View File

@@ -1,9 +1,12 @@
[gd_scene load_steps=81 format=3 uid="uid://dcgj5i52i76gj"] [gd_scene load_steps=90 format=3 uid="uid://b0gwivt7cw7nd"]
[ext_resource type="Script" path="res://src/enemy/Enemy.cs" id="1_a6wro"] [ext_resource type="Script" path="res://src/enemy/Enemy.cs" id="1_a6wro"]
[ext_resource type="Script" path="res://src/enemy/EnemyStatResource.cs" id="2_x4pjh"] [ext_resource type="Script" path="res://src/enemy/EnemyStatResource.cs" id="2_x4pjh"]
[ext_resource type="Script" path="res://src/hitbox/Hitbox.cs" id="3_aiftp"] [ext_resource type="Script" path="res://src/hitbox/Hitbox.cs" id="3_aiftp"]
[ext_resource type="Shader" path="res://src/vfx/shaders/DamageHit.gdshader" id="3_ekj3e"]
[ext_resource type="Material" uid="uid://c0gpeve05njqq" path="res://src/vfx/shaders/DamageHit.tres" id="4_01npl"]
[ext_resource type="Texture2D" uid="uid://clpqh2pyqljkn" path="res://src/enemy/enemy_types/michael/animations/IDLE_WALK/BACK/Michael_Walk_Idle_Back (1).png" id="4_7kurm"] [ext_resource type="Texture2D" uid="uid://clpqh2pyqljkn" path="res://src/enemy/enemy_types/michael/animations/IDLE_WALK/BACK/Michael_Walk_Idle_Back (1).png" id="4_7kurm"]
[ext_resource type="Shader" path="res://src/vfx/shaders/PixelMelt.gdshader" id="4_h4oxj"]
[ext_resource type="Texture2D" uid="uid://b0dec8ak2bo5t" path="res://src/enemy/enemy_types/michael/animations/IDLE_WALK/BACK/Michael_Walk_Idle_Back (2).png" id="5_1a1hr"] [ext_resource type="Texture2D" uid="uid://b0dec8ak2bo5t" path="res://src/enemy/enemy_types/michael/animations/IDLE_WALK/BACK/Michael_Walk_Idle_Back (2).png" id="5_1a1hr"]
[ext_resource type="Texture2D" uid="uid://tnmyksd68vmv" path="res://src/enemy/enemy_types/michael/animations/IDLE_WALK/BACK/Michael_Walk_Idle_Back (3).png" id="6_p47tl"] [ext_resource type="Texture2D" uid="uid://tnmyksd68vmv" path="res://src/enemy/enemy_types/michael/animations/IDLE_WALK/BACK/Michael_Walk_Idle_Back (3).png" id="6_p47tl"]
[ext_resource type="Texture2D" uid="uid://duwipvc2kl6xa" path="res://src/enemy/enemy_types/michael/animations/IDLE_WALK/BACK/Michael_Walk_Idle_Back (4).png" id="7_efmib"] [ext_resource type="Texture2D" uid="uid://duwipvc2kl6xa" path="res://src/enemy/enemy_types/michael/animations/IDLE_WALK/BACK/Michael_Walk_Idle_Back (4).png" id="7_efmib"]
@@ -82,62 +85,245 @@ CurrentDefense = 2
MaxAttack = 3 MaxAttack = 3
MaxDefense = 2 MaxDefense = 2
Luck = 0.05 Luck = 0.05
TelluricResistance = null TelluricResistance = 0.0
AeolicResistance = null AeolicResistance = 0.0
HydricResistance = null HydricResistance = 0.0
IgneousResistance = null IgneousResistance = 0.0
FerrumResistance = null FerrumResistance = 0.0
TelluricDamageBonus = null TelluricDamageBonus = 0.0
AeolicDamageBonus = null AeolicDamageBonus = 0.0
BaseHydricDamageBonus = null BaseHydricDamageBonus = 0.0
IgneousDamageBonus = null IgneousDamageBonus = 0.0
FerrumDamageBonus = null FerrumDamageBonus = 0.0
[sub_resource type="CylinderShape3D" id="CylinderShape3D_jbgmx"] [sub_resource type="CylinderShape3D" id="CylinderShape3D_jbgmx"]
height = 3.0 height = 3.0
radius = 1.0 radius = 1.0
[sub_resource type="Animation" id="Animation_kr7ax"] [sub_resource type="BoxShape3D" id="BoxShape3D_0yire"]
size = Vector3(1, 0.564941, 1.14453)
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_cwfph"]
height = 1.0
[sub_resource type="Animation" id="Animation_41ppy"]
length = 0.001 length = 0.001
tracks/0/type = "value" tracks/0/type = "value"
tracks/0/imported = false tracks/0/imported = false
tracks/0/enabled = true tracks/0/enabled = true
tracks/0/path = NodePath("Hitbox/CollisionShape3D:disabled") tracks/0/path = NodePath("Michael/Sprite/SubViewport/AnimatedSprite:material:shader")
tracks/0/interp = 1 tracks/0/interp = 1
tracks/0/loop_wrap = true tracks/0/loop_wrap = true
tracks/0/keys = { tracks/0/keys = {
"times": PackedFloat32Array(0), "times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1), "transitions": PackedFloat32Array(1),
"update": 1, "update": 1,
"values": [true] "values": [null]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Michael/Sprite/SubViewport/AnimatedSprite:material:shader_parameter/progress")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [-1.0]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("Michael/Sprite/SubViewport/AnimatedSprite:animation")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [&"idle_front_walk"]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("Michael/Sprite/SubViewport/AnimatedSprite:frame")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [0]
} }
[sub_resource type="Animation" id="Animation_ce86e"] [sub_resource type="Animation" id="Animation_0k3e8"]
resource_name = "attack" resource_name = "attack"
length = 0.7 step = 0.0833333
[sub_resource type="Animation" id="Animation_htxsv"]
resource_name = "defeated"
length = 1.00001
step = 0.0833333
tracks/0/type = "value" tracks/0/type = "value"
tracks/0/imported = false tracks/0/imported = false
tracks/0/enabled = true tracks/0/enabled = true
tracks/0/path = NodePath("Hitbox/CollisionShape3D:disabled") tracks/0/path = NodePath("Michael/Sprite/SubViewport/AnimatedSprite:material:shader")
tracks/0/interp = 1 tracks/0/interp = 1
tracks/0/loop_wrap = true tracks/0/loop_wrap = true
tracks/0/keys = { tracks/0/keys = {
"times": PackedFloat32Array(0, 0.3, 0.5), "times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1, 1, 1), "transitions": PackedFloat32Array(1),
"update": 1, "update": 1,
"values": [true, false, true] "values": [ExtResource("4_h4oxj")]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Michael/Sprite/SubViewport/AnimatedSprite:material:shader_parameter/progress")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [0.0, 1.0]
}
[sub_resource type="Animation" id="Animation_fjkm0"]
resource_name = "hit"
length = 0.666675
step = 0.0833333
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Michael/Sprite/SubViewport/AnimatedSprite:material:shader")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.666667),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [ExtResource("3_ekj3e"), null]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Michael/Sprite/SubViewport/AnimatedSprite:material:shader_parameter/progress")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.666667),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [-1.0, 1.0]
}
[sub_resource type="Animation" id="Animation_3dffb"]
resource_name = "idle_front_walk"
length = 1.91667
loop_mode = 1
step = 0.0833333
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Michael/Sprite/SubViewport/AnimatedSprite:animation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [&"idle_front_walk"]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Michael/Sprite/SubViewport/AnimatedSprite:frame")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.0833333, 0.166667, 0.25, 0.333333, 0.416667, 0.5, 0.583333, 0.666666, 0.75, 0.833333, 0.916666, 1, 1.08333, 1.16667, 1.25, 1.33333, 1.41667, 1.5, 1.58333, 1.66667, 1.75, 1.83333),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22]
}
[sub_resource type="Animation" id="Animation_0qxqf"]
resource_name = "idle_left_walk"
length = 1.91667
loop_mode = 1
step = 0.0833333
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Michael/Sprite/SubViewport/AnimatedSprite:animation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [&"idle_left_walk"]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Michael/Sprite/SubViewport/AnimatedSprite:frame")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.0833333, 0.166667, 0.25, 0.333333, 0.416667, 0.5, 0.583333, 0.666666, 0.75, 0.833333, 0.916666, 1, 1.08333, 1.16667, 1.25, 1.33333, 1.41667, 1.5, 1.58333, 1.66667, 1.75, 1.83333),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22]
}
[sub_resource type="Animation" id="Animation_ppbeh"]
resource_name = "idle_back_walk"
length = 1.91667
loop_mode = 1
step = 0.0833333
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Michael/Sprite/SubViewport/AnimatedSprite:animation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [&"idle_back_walk"]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Michael/Sprite/SubViewport/AnimatedSprite:frame")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.0833333, 0.166667, 0.25, 0.333333, 0.416667, 0.5, 0.583333, 0.666666, 0.75, 0.833333, 0.916666, 1, 1.08333, 1.16667, 1.25, 1.33333, 1.41667, 1.5, 1.58333, 1.66667, 1.75, 1.83333),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22]
} }
[sub_resource type="AnimationLibrary" id="AnimationLibrary_346xs"] [sub_resource type="AnimationLibrary" id="AnimationLibrary_346xs"]
_data = { _data = {
"RESET": SubResource("Animation_kr7ax"), "RESET": SubResource("Animation_41ppy"),
"attack": SubResource("Animation_ce86e") "attack": SubResource("Animation_0k3e8"),
"defeated": SubResource("Animation_htxsv"),
"hit": SubResource("Animation_fjkm0"),
"idle_back_walk": SubResource("Animation_ppbeh"),
"idle_front_walk": SubResource("Animation_3dffb"),
"idle_left_walk": SubResource("Animation_0qxqf")
} }
[sub_resource type="BoxShape3D" id="BoxShape3D_0yire"] [sub_resource type="ViewportTexture" id="ViewportTexture_57rcc"]
size = Vector3(1, 0.564941, 1.14453) viewport_path = NodePath("Sprite/SubViewport")
[sub_resource type="SpriteFrames" id="SpriteFrames_x7baa"] [sub_resource type="SpriteFrames" id="SpriteFrames_8xwq0"]
animations = [{ animations = [{
"frames": [{ "frames": [{
"duration": 1.0, "duration": 1.0,
@@ -362,9 +548,6 @@ animations = [{
"speed": 12.0 "speed": 12.0
}] }]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_cwfph"]
height = 1.0
[node name="Michael" type="CharacterBody3D"] [node name="Michael" type="CharacterBody3D"]
process_mode = 1 process_mode = 1
collision_layer = 10 collision_layer = 10
@@ -393,12 +576,6 @@ unique_name_in_owner = true
wait_time = 1.8 wait_time = 1.8
autostart = true autostart = true
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
unique_name_in_owner = true
libraries = {
"": SubResource("AnimationLibrary_346xs")
}
[node name="Hitbox" type="Area3D" parent="."] [node name="Hitbox" type="Area3D" parent="."]
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, -0.152949, 0, 0) transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, -0.152949, 0, 0)
collision_layer = 64 collision_layer = 64
@@ -413,18 +590,9 @@ disabled = true
[node name="Raycast" type="RayCast3D" parent="."] [node name="Raycast" type="RayCast3D" parent="."]
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0) transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0)
visible = false
target_position = Vector3(0, 0, -3) target_position = Vector3(0, 0, -3)
collision_mask = 3 collision_mask = 3
[node name="AnimatedSprite" type="AnimatedSprite3D" parent="."]
unique_name_in_owner = true
billboard = 2
double_sided = false
texture_filter = 0
sprite_frames = SubResource("SpriteFrames_x7baa")
animation = &"idle_back_walk"
[node name="CollisionShape3D" type="CollisionShape3D" parent="."] [node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0) transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0)
shape = SubResource("CapsuleShape3D_cwfph") shape = SubResource("CapsuleShape3D_cwfph")
@@ -434,3 +602,25 @@ unique_name_in_owner = true
avoidance_enabled = true avoidance_enabled = true
debug_enabled = true debug_enabled = true
debug_path_custom_color = Color(1, 0, 0, 1) debug_path_custom_color = Color(1, 0, 0, 1)
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
unique_name_in_owner = true
root_node = NodePath("../..")
libraries = {
"": SubResource("AnimationLibrary_346xs")
}
[node name="Sprite" type="Sprite3D" parent="."]
billboard = 2
texture = SubResource("ViewportTexture_57rcc")
[node name="SubViewport" type="SubViewport" parent="Sprite"]
transparent_bg = true
size = Vector2i(95, 95)
[node name="AnimatedSprite" type="AnimatedSprite2D" parent="Sprite/SubViewport"]
unique_name_in_owner = true
material = ExtResource("4_01npl")
position = Vector2(45, 45)
sprite_frames = SubResource("SpriteFrames_8xwq0")
animation = &"idle_front_walk"

View File

@@ -1,49 +0,0 @@
using GameJamDungeon;
using Godot;
using System;
public partial class RotationTest : CharacterBody3D
{
private Camera3D _camera;
private AnimatedSprite3D _sprite;
private Label _frameLabel;
private float _rotateUpperThreshold = 0.85f;
private float _rotateLowerThreshold = 0.3f;
public override void _Ready()
{
_camera = GetParent().GetNode<Camera3D>("%TestCamera");
_sprite = GetNode<AnimatedSprite3D>("%AnimatedSprite");
_frameLabel = GetNode<Label>("%CurrentFrameLabel");
}
public override void _Process(double delta)
{
RotateEnemy(_camera.GlobalTransform.Basis.Z);
}
private void RotateEnemy(Vector3 cameraDirection)
{
var enemyForwardDirection = GlobalTransform.Basis.Z;
var enemyLeftDirection = GlobalTransform.Basis.X;
var leftDotProduct = enemyLeftDirection.Dot(cameraDirection);
var forwardDotProduct = enemyForwardDirection.Dot(cameraDirection);
// Check if forward facing. If the dot product is -1, the enemy is facing the camera.
if (forwardDotProduct < -_rotateUpperThreshold)
_sprite.Play("idle_front_walk");
// Check if backward facing. If the dot product is 1, the enemy is facing the same direction as the camera.
else if (forwardDotProduct > _rotateUpperThreshold)
_sprite.Play("idle_back_walk");
else
{
// If the dot product of the perpendicular dot product is positive (up to 1), the enemy is facing to the left (since it's mirrored).
_sprite.FlipH = leftDotProduct > 0;
// Check is side facing. If the dot product is close to zero in the positive or negative direction, its close to the threshold for turning.
if (Mathf.Abs(forwardDotProduct) < _rotateLowerThreshold)
_sprite.Play("idle_left_walk");
}
}
}

View File

@@ -1,18 +1,9 @@
[gd_scene load_steps=67 format=3 uid="uid://bksq62muhk3h5"] [gd_scene load_steps=76 format=3 uid="uid://bksq62muhk3h5"]
[ext_resource type="Script" path="res://src/enemy/Enemy.cs" id="1_7tinp"] [ext_resource type="Script" path="res://src/enemy/Enemy.cs" id="1_7tinp"]
[ext_resource type="Script" path="res://src/enemy/EnemyStatResource.cs" id="2_j3knd"] [ext_resource type="Script" path="res://src/enemy/EnemyStatResource.cs" id="2_j3knd"]
[ext_resource type="Script" path="res://src/hitbox/Hitbox.cs" id="3_usw2d"] [ext_resource type="Script" path="res://src/hitbox/Hitbox.cs" id="3_usw2d"]
[ext_resource type="Texture2D" uid="uid://dd0ia6isdqg61" path="res://src/enemy/enemy_types/sproingy/animations/ATTACK/Layer 1.png" id="4_f5aht"] [ext_resource type="Material" uid="uid://c0gpeve05njqq" path="res://src/vfx/shaders/DamageHit.tres" id="4_0urvb"]
[ext_resource type="Texture2D" uid="uid://bs4ico5ouo5d3" path="res://src/enemy/enemy_types/sproingy/animations/ATTACK/Layer 2.png" id="5_cla00"]
[ext_resource type="Texture2D" uid="uid://85ki5mc4h0vs" path="res://src/enemy/enemy_types/sproingy/animations/ATTACK/Layer 3.png" id="6_d23kt"]
[ext_resource type="Texture2D" uid="uid://bwt1m2frb3r0e" path="res://src/enemy/enemy_types/sproingy/animations/ATTACK/Layer 4.png" id="7_1s02c"]
[ext_resource type="Texture2D" uid="uid://ckssl1np6vnlu" path="res://src/enemy/enemy_types/sproingy/animations/ATTACK/Layer 5.png" id="8_nxv3t"]
[ext_resource type="Texture2D" uid="uid://c4sqc6i3xcfac" path="res://src/enemy/enemy_types/sproingy/animations/ATTACK/Layer 6.png" id="9_l4m8n"]
[ext_resource type="Texture2D" uid="uid://cawexe4wkosc8" path="res://src/enemy/enemy_types/sproingy/animations/ATTACK/Layer 7.png" id="10_l11ks"]
[ext_resource type="Texture2D" uid="uid://d0j1vrx7xdnxl" path="res://src/enemy/enemy_types/sproingy/animations/ATTACK/Layer 8.png" id="11_1h5et"]
[ext_resource type="Texture2D" uid="uid://d0qhndaukki7c" path="res://src/enemy/enemy_types/sproingy/animations/ATTACK/Layer 9.png" id="12_iu7dx"]
[ext_resource type="Texture2D" uid="uid://cnd08q34wa7ww" path="res://src/enemy/enemy_types/sproingy/animations/ATTACK/Layer 10.png" id="13_vbxxn"]
[ext_resource type="Texture2D" uid="uid://b8ntr7hh6rr5h" path="res://src/enemy/enemy_types/sproingy/animations/IDLE_WALK_BACK/Layer 1.png" id="14_xn75i"] [ext_resource type="Texture2D" uid="uid://b8ntr7hh6rr5h" path="res://src/enemy/enemy_types/sproingy/animations/IDLE_WALK_BACK/Layer 1.png" id="14_xn75i"]
[ext_resource type="Texture2D" uid="uid://csgthlou2tnvb" path="res://src/enemy/enemy_types/sproingy/animations/IDLE_WALK_BACK/Layer 2.png" id="15_rgyxs"] [ext_resource type="Texture2D" uid="uid://csgthlou2tnvb" path="res://src/enemy/enemy_types/sproingy/animations/IDLE_WALK_BACK/Layer 2.png" id="15_rgyxs"]
[ext_resource type="Texture2D" uid="uid://cfyxuk85350gn" path="res://src/enemy/enemy_types/sproingy/animations/IDLE_WALK_BACK/Layer 3.png" id="16_nr3ob"] [ext_resource type="Texture2D" uid="uid://cfyxuk85350gn" path="res://src/enemy/enemy_types/sproingy/animations/IDLE_WALK_BACK/Layer 3.png" id="16_nr3ob"]
@@ -49,15 +40,27 @@
[ext_resource type="Texture2D" uid="uid://dlbt7lj5ryl0v" path="res://src/enemy/enemy_types/sproingy/animations/IDLE_WALK_SIDE/Layer 4.png" id="47_1j2ir"] [ext_resource type="Texture2D" uid="uid://dlbt7lj5ryl0v" path="res://src/enemy/enemy_types/sproingy/animations/IDLE_WALK_SIDE/Layer 4.png" id="47_1j2ir"]
[ext_resource type="Texture2D" uid="uid://bkhn4ck7bx6tt" path="res://src/enemy/enemy_types/sproingy/animations/IDLE_WALK_SIDE/Layer 5.png" id="48_864dg"] [ext_resource type="Texture2D" uid="uid://bkhn4ck7bx6tt" path="res://src/enemy/enemy_types/sproingy/animations/IDLE_WALK_SIDE/Layer 5.png" id="48_864dg"]
[ext_resource type="Texture2D" uid="uid://c8uw6qdsi1720" path="res://src/enemy/enemy_types/sproingy/animations/IDLE_WALK_SIDE/Layer 6.png" id="49_2r4d5"] [ext_resource type="Texture2D" uid="uid://c8uw6qdsi1720" path="res://src/enemy/enemy_types/sproingy/animations/IDLE_WALK_SIDE/Layer 6.png" id="49_2r4d5"]
[ext_resource type="Shader" path="res://src/vfx/shaders/DamageHit.gdshader" id="49_mrxyf"]
[ext_resource type="Texture2D" uid="uid://dd0ia6isdqg61" path="res://src/enemy/enemy_types/sproingy/animations/ATTACK/Layer 1.png" id="50_fxgra"]
[ext_resource type="Texture2D" uid="uid://cnoouhy7p3gi3" path="res://src/enemy/enemy_types/sproingy/animations/IDLE_WALK_SIDE/Layer 7.png" id="50_m33xn"] [ext_resource type="Texture2D" uid="uid://cnoouhy7p3gi3" path="res://src/enemy/enemy_types/sproingy/animations/IDLE_WALK_SIDE/Layer 7.png" id="50_m33xn"]
[ext_resource type="Texture2D" uid="uid://b1xldymngql00" path="res://src/enemy/enemy_types/sproingy/animations/IDLE_WALK_SIDE/Layer 8.png" id="51_68cc3"] [ext_resource type="Texture2D" uid="uid://b1xldymngql00" path="res://src/enemy/enemy_types/sproingy/animations/IDLE_WALK_SIDE/Layer 8.png" id="51_68cc3"]
[ext_resource type="Texture2D" uid="uid://bs4ico5ouo5d3" path="res://src/enemy/enemy_types/sproingy/animations/ATTACK/Layer 2.png" id="51_ebmer"]
[ext_resource type="Shader" path="res://src/vfx/shaders/PixelMelt.gdshader" id="51_y2own"]
[ext_resource type="Texture2D" uid="uid://btuxhmmb6ikvf" path="res://src/enemy/enemy_types/sproingy/animations/IDLE_WALK_SIDE/Layer 9.png" id="52_2xmc3"] [ext_resource type="Texture2D" uid="uid://btuxhmmb6ikvf" path="res://src/enemy/enemy_types/sproingy/animations/IDLE_WALK_SIDE/Layer 9.png" id="52_2xmc3"]
[ext_resource type="Texture2D" uid="uid://85ki5mc4h0vs" path="res://src/enemy/enemy_types/sproingy/animations/ATTACK/Layer 3.png" id="52_y2cis"]
[ext_resource type="Texture2D" uid="uid://bwt1m2frb3r0e" path="res://src/enemy/enemy_types/sproingy/animations/ATTACK/Layer 4.png" id="53_7t81a"]
[ext_resource type="Texture2D" uid="uid://dlrn3cbdubg5s" path="res://src/enemy/enemy_types/sproingy/animations/IDLE_WALK_SIDE/Layer 10.png" id="53_bgv07"] [ext_resource type="Texture2D" uid="uid://dlrn3cbdubg5s" path="res://src/enemy/enemy_types/sproingy/animations/IDLE_WALK_SIDE/Layer 10.png" id="53_bgv07"]
[ext_resource type="Texture2D" uid="uid://oukshrxpgscg" path="res://src/enemy/enemy_types/sproingy/animations/IDLE_WALK_SIDE/Layer 11.png" id="54_7gaxo"] [ext_resource type="Texture2D" uid="uid://oukshrxpgscg" path="res://src/enemy/enemy_types/sproingy/animations/IDLE_WALK_SIDE/Layer 11.png" id="54_7gaxo"]
[ext_resource type="Texture2D" uid="uid://ckssl1np6vnlu" path="res://src/enemy/enemy_types/sproingy/animations/ATTACK/Layer 5.png" id="54_xg1s7"]
[ext_resource type="Texture2D" uid="uid://buk3stdgcg44w" path="res://src/enemy/enemy_types/sproingy/animations/IDLE_WALK_SIDE/Layer 12.png" id="55_6460k"] [ext_resource type="Texture2D" uid="uid://buk3stdgcg44w" path="res://src/enemy/enemy_types/sproingy/animations/IDLE_WALK_SIDE/Layer 12.png" id="55_6460k"]
[ext_resource type="Texture2D" uid="uid://c4sqc6i3xcfac" path="res://src/enemy/enemy_types/sproingy/animations/ATTACK/Layer 6.png" id="55_e0qrl"]
[ext_resource type="Texture2D" uid="uid://b3gndmrlrvexy" path="res://src/enemy/enemy_types/sproingy/animations/IDLE_WALK_SIDE/Layer 13.png" id="56_4pv43"] [ext_resource type="Texture2D" uid="uid://b3gndmrlrvexy" path="res://src/enemy/enemy_types/sproingy/animations/IDLE_WALK_SIDE/Layer 13.png" id="56_4pv43"]
[ext_resource type="Texture2D" uid="uid://cawexe4wkosc8" path="res://src/enemy/enemy_types/sproingy/animations/ATTACK/Layer 7.png" id="56_eeb3j"]
[ext_resource type="Texture2D" uid="uid://d0j1vrx7xdnxl" path="res://src/enemy/enemy_types/sproingy/animations/ATTACK/Layer 8.png" id="57_p183w"]
[ext_resource type="Texture2D" uid="uid://b1cmx8l4ia3fv" path="res://src/enemy/enemy_types/sproingy/animations/IDLE_WALK_SIDE/Layer 14.png" id="57_tbahh"] [ext_resource type="Texture2D" uid="uid://b1cmx8l4ia3fv" path="res://src/enemy/enemy_types/sproingy/animations/IDLE_WALK_SIDE/Layer 14.png" id="57_tbahh"]
[ext_resource type="Texture2D" uid="uid://c7t4626rox02s" path="res://src/enemy/enemy_types/sproingy/animations/IDLE_WALK_SIDE/Layer 15.png" id="58_dftc5"] [ext_resource type="Texture2D" uid="uid://c7t4626rox02s" path="res://src/enemy/enemy_types/sproingy/animations/IDLE_WALK_SIDE/Layer 15.png" id="58_dftc5"]
[ext_resource type="Texture2D" uid="uid://d0qhndaukki7c" path="res://src/enemy/enemy_types/sproingy/animations/ATTACK/Layer 9.png" id="58_lhas6"]
[ext_resource type="Texture2D" uid="uid://cnd08q34wa7ww" path="res://src/enemy/enemy_types/sproingy/animations/ATTACK/Layer 10.png" id="59_nlkte"]
[sub_resource type="Resource" id="Resource_rxw8v"] [sub_resource type="Resource" id="Resource_rxw8v"]
script = ExtResource("2_j3knd") script = ExtResource("2_j3knd")
@@ -68,98 +71,64 @@ CurrentDefense = 2
MaxAttack = 3 MaxAttack = 3
MaxDefense = 2 MaxDefense = 2
Luck = 0.05 Luck = 0.05
TelluricResistance = null TelluricResistance = 0.0
AeolicResistance = null AeolicResistance = 0.0
HydricResistance = null HydricResistance = 0.0
IgneousResistance = null IgneousResistance = 0.0
FerrumResistance = null FerrumResistance = 0.0
TelluricDamageBonus = null TelluricDamageBonus = 0.0
AeolicDamageBonus = null AeolicDamageBonus = 0.0
BaseHydricDamageBonus = null BaseHydricDamageBonus = 0.0
IgneousDamageBonus = null IgneousDamageBonus = 0.0
FerrumDamageBonus = null FerrumDamageBonus = 0.0
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_cwfph"] [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_cwfph"]
height = 1.0 radius = 1.0
[sub_resource type="CylinderShape3D" id="CylinderShape3D_jbgmx"] [sub_resource type="CylinderShape3D" id="CylinderShape3D_jbgmx"]
height = 3.0 height = 3.0
radius = 1.0 radius = 1.0
[sub_resource type="Animation" id="Animation_kr7ax"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Hitbox/CollisionShape3D:disabled")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
[sub_resource type="Animation" id="Animation_ce86e"]
resource_name = "attack"
length = 0.7
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Hitbox/CollisionShape3D:disabled")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.3, 0.5),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [true, false, true]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_346xs"]
_data = {
"RESET": SubResource("Animation_kr7ax"),
"attack": SubResource("Animation_ce86e")
}
[sub_resource type="BoxShape3D" id="BoxShape3D_0yire"] [sub_resource type="BoxShape3D" id="BoxShape3D_0yire"]
size = Vector3(1, 0.564941, 1.14453) size = Vector3(1, 0.564941, 1.14453)
[sub_resource type="SpriteFrames" id="SpriteFrames_x7baa"] [sub_resource type="ViewportTexture" id="ViewportTexture_moptw"]
viewport_path = NodePath("Sprite3D/SubViewport")
[sub_resource type="SpriteFrames" id="SpriteFrames_mi16l"]
animations = [{ animations = [{
"frames": [{ "frames": [{
"duration": 1.0, "duration": 1.0,
"texture": ExtResource("4_f5aht") "texture": ExtResource("50_fxgra")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": ExtResource("5_cla00") "texture": ExtResource("51_ebmer")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": ExtResource("6_d23kt") "texture": ExtResource("52_y2cis")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": ExtResource("7_1s02c") "texture": ExtResource("53_7t81a")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": ExtResource("8_nxv3t") "texture": ExtResource("54_xg1s7")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": ExtResource("9_l4m8n") "texture": ExtResource("55_e0qrl")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": ExtResource("10_l11ks") "texture": ExtResource("56_eeb3j")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": ExtResource("11_1h5et") "texture": ExtResource("57_p183w")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": ExtResource("12_iu7dx") "texture": ExtResource("58_lhas6")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": ExtResource("13_vbxxn") "texture": ExtResource("59_nlkte")
}], }],
"loop": true, "loop": false,
"name": &"attack", "name": &"attack",
"speed": 12.0 "speed": 12.0
}, { }, {
@@ -314,6 +283,245 @@ animations = [{
"speed": 12.0 "speed": 12.0
}] }]
[sub_resource type="Animation" id="Animation_ch8ic"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite3D/SubViewport/AnimatedSprite:material:shader")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [null]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Sprite3D/SubViewport/AnimatedSprite:material:shader_parameter/progress")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.0]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("Sprite3D/SubViewport/AnimatedSprite:frame")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [0]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("Sprite3D/SubViewport/AnimatedSprite:animation")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [&"idle_left_walk"]
}
[sub_resource type="Animation" id="Animation_lkjbu"]
resource_name = "defeated"
length = 1.00001
step = 0.0833333
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite3D/SubViewport/AnimatedSprite:material:shader")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [ExtResource("51_y2own")]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Sprite3D/SubViewport/AnimatedSprite:material:shader_parameter/progress")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [0.0, 1.0]
}
[sub_resource type="Animation" id="Animation_03gvk"]
resource_name = "hit"
length = 0.500008
step = 0.0833333
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite3D/SubViewport/AnimatedSprite:material:shader")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.5),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [ExtResource("49_mrxyf"), null]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Sprite3D/SubViewport/AnimatedSprite:material:shader_parameter/progress")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.5),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [0.0, 1.0]
}
[sub_resource type="Animation" id="Animation_ruc6s"]
resource_name = "attack"
length = 0.750008
step = 0.0833333
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite3D/SubViewport/AnimatedSprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.0833333, 0.166667, 0.25, 0.333333, 0.416667, 0.5, 0.583333, 0.666666, 0.75),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Sprite3D/SubViewport/AnimatedSprite:animation")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [&"attack"]
}
[sub_resource type="Animation" id="Animation_31nry"]
resource_name = "idle_front_walk"
length = 1.25001
loop_mode = 1
step = 0.0833333
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite3D/SubViewport/AnimatedSprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.0833333, 0.166667, 0.25, 0.333333, 0.416667, 0.5, 0.583333, 0.666667, 0.75, 0.833333, 0.916667, 1, 1.08333, 1.16667),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Sprite3D/SubViewport/AnimatedSprite:animation")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [&"idle_front_walk"]
}
[sub_resource type="Animation" id="Animation_1870e"]
resource_name = "idle_left_walk"
length = 1.25001
loop_mode = 1
step = 0.0833333
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite3D/SubViewport/AnimatedSprite:animation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [&"idle_left_walk"]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Sprite3D/SubViewport/AnimatedSprite:frame")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.0833333, 0.166667, 0.25, 0.333333, 0.416667, 0.5, 0.583333, 0.666666, 0.75, 0.833333, 0.916666, 1, 1.08333, 1.16667),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
}
[sub_resource type="Animation" id="Animation_1tda5"]
resource_name = "idle_back_walk"
length = 1.25001
loop_mode = 1
step = 0.0833333
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite3D/SubViewport/AnimatedSprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.0833333, 0.166667, 0.25, 0.333333, 0.416667, 0.5, 0.583333, 0.666666, 0.75, 0.833333, 0.916666, 1, 1.08333, 1.16667),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Sprite3D/SubViewport/AnimatedSprite:animation")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [&"idle_back_walk"]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_6tj5r"]
_data = {
"RESET": SubResource("Animation_ch8ic"),
"attack": SubResource("Animation_ruc6s"),
"defeated": SubResource("Animation_lkjbu"),
"hit": SubResource("Animation_03gvk"),
"idle_back_walk": SubResource("Animation_1tda5"),
"idle_front_walk": SubResource("Animation_31nry"),
"idle_left_walk": SubResource("Animation_1870e")
}
[node name="Sproingy" type="CharacterBody3D"] [node name="Sproingy" type="CharacterBody3D"]
process_mode = 1 process_mode = 1
collision_layer = 10 collision_layer = 10
@@ -322,16 +530,16 @@ axis_lock_linear_y = true
script = ExtResource("1_7tinp") script = ExtResource("1_7tinp")
EnemyStatResource = SubResource("Resource_rxw8v") EnemyStatResource = SubResource("Resource_rxw8v")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0)
shape = SubResource("CapsuleShape3D_cwfph")
[node name="NavAgent" type="NavigationAgent3D" parent="."] [node name="NavAgent" type="NavigationAgent3D" parent="."]
unique_name_in_owner = true unique_name_in_owner = true
avoidance_enabled = true avoidance_enabled = true
debug_enabled = true debug_enabled = true
debug_path_custom_color = Color(1, 0, 0, 1) debug_path_custom_color = Color(1, 0, 0, 1)
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0)
shape = SubResource("CapsuleShape3D_cwfph")
[node name="LineOfSight" type="Area3D" parent="."] [node name="LineOfSight" type="Area3D" parent="."]
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0) transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0)
@@ -352,33 +560,42 @@ unique_name_in_owner = true
wait_time = 1.8 wait_time = 1.8
autostart = true autostart = true
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
unique_name_in_owner = true
libraries = {
"": SubResource("AnimationLibrary_346xs")
}
[node name="Hitbox" type="Area3D" parent="."] [node name="Hitbox" type="Area3D" parent="."]
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0) transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, -0.152949, 0, 0)
collision_layer = 64 collision_layer = 64
collision_mask = 64 collision_mask = 64
script = ExtResource("3_usw2d") script = ExtResource("3_usw2d")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Hitbox"] [node name="CollisionShape3D" type="CollisionShape3D" parent="Hitbox"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0470563, 0.217529, -0.78415) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.189337, 0.217529, -0.78415)
shape = SubResource("BoxShape3D_0yire") shape = SubResource("BoxShape3D_0yire")
disabled = true disabled = true
[node name="Raycast" type="RayCast3D" parent="."] [node name="Raycast" type="RayCast3D" parent="."]
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0) transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0)
visible = false
target_position = Vector3(0, 0, -3) target_position = Vector3(0, 0, -3)
collision_mask = 3 collision_mask = 3
[node name="AnimatedSprite" type="AnimatedSprite3D" parent="."] [node name="Sprite3D" type="Sprite3D" parent="."]
unique_name_in_owner = true transform = Transform3D(1.5, 0, 0, 0, 1.5, 0, 0, 0, 1.5, 0, 0, 0)
billboard = 2 billboard = 2
texture_filter = 0 texture = SubResource("ViewportTexture_moptw")
sprite_frames = SubResource("SpriteFrames_x7baa")
animation = &"attack" [node name="SubViewport" type="SubViewport" parent="Sprite3D"]
disable_3d = true
transparent_bg = true
size = Vector2i(95, 95)
[node name="AnimatedSprite" type="AnimatedSprite2D" parent="Sprite3D/SubViewport"]
unique_name_in_owner = true
material = ExtResource("4_0urvb")
position = Vector2(45, 45)
sprite_frames = SubResource("SpriteFrames_mi16l")
animation = &"idle_left_walk"
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
unique_name_in_owner = true
libraries = {
"": SubResource("AnimationLibrary_6tj5r")
}

View File

@@ -15,7 +15,7 @@ namespace GameJamDungeon
public readonly record struct HitByPlayer(double Damage); public readonly record struct HitByPlayer(double Damage);
public readonly record struct Killed(); public readonly record struct EnemyDefeated();
public readonly record struct PatrolToRandomSpot(Vector3 PatrolTarget); public readonly record struct PatrolToRandomSpot(Vector3 PatrolTarget);

View File

@@ -12,7 +12,9 @@ namespace GameJamDungeon
public readonly record struct HitByPlayer(double CurrentHP); public readonly record struct HitByPlayer(double CurrentHP);
public readonly record struct Die(); public readonly record struct Attack();
public readonly record struct Defeated();
} }
} }
} }

View File

@@ -1,22 +1,25 @@
@startuml EnemyLogic @startuml EnemyLogic
state "EnemyLogic State" as GameJamDungeon_EnemyLogic_State { state "EnemyLogic State" as GameJamDungeon_EnemyLogic_State {
state "Alive" as GameJamDungeon_EnemyLogic_State_Alive { state "Alive" as GameJamDungeon_EnemyLogic_State_Alive {
state "Attack" as GameJamDungeon_EnemyLogic_State_Attack
state "FollowPlayer" as GameJamDungeon_EnemyLogic_State_FollowPlayer state "FollowPlayer" as GameJamDungeon_EnemyLogic_State_FollowPlayer
state "Idle" as GameJamDungeon_EnemyLogic_State_Idle state "Idle" as GameJamDungeon_EnemyLogic_State_Idle
} }
state "Defeated" as GameJamDungeon_EnemyLogic_State_Defeated
} }
GameJamDungeon_EnemyLogic_State_Alive --> GameJamDungeon_EnemyLogic_State_Alive : AttackTimer
GameJamDungeon_EnemyLogic_State_Alive --> GameJamDungeon_EnemyLogic_State_Alive : HitByPlayer GameJamDungeon_EnemyLogic_State_Alive --> GameJamDungeon_EnemyLogic_State_Alive : HitByPlayer
GameJamDungeon_EnemyLogic_State_Alive --> GameJamDungeon_EnemyLogic_State_Attack : AttackTimer GameJamDungeon_EnemyLogic_State_Alive --> GameJamDungeon_EnemyLogic_State_Defeated : EnemyDefeated
GameJamDungeon_EnemyLogic_State_Attack --> GameJamDungeon_EnemyLogic_State_FollowPlayer : Alerted
GameJamDungeon_EnemyLogic_State_FollowPlayer --> GameJamDungeon_EnemyLogic_State_FollowPlayer : PhysicsTick GameJamDungeon_EnemyLogic_State_FollowPlayer --> GameJamDungeon_EnemyLogic_State_FollowPlayer : PhysicsTick
GameJamDungeon_EnemyLogic_State_FollowPlayer --> GameJamDungeon_EnemyLogic_State_Idle : LostPlayer GameJamDungeon_EnemyLogic_State_FollowPlayer --> GameJamDungeon_EnemyLogic_State_Idle : LostPlayer
GameJamDungeon_EnemyLogic_State_Idle --> GameJamDungeon_EnemyLogic_State_FollowPlayer : Alerted GameJamDungeon_EnemyLogic_State_Idle --> GameJamDungeon_EnemyLogic_State_FollowPlayer : Alerted
GameJamDungeon_EnemyLogic_State_Idle --> GameJamDungeon_EnemyLogic_State_Idle : PatrolToRandomSpot GameJamDungeon_EnemyLogic_State_Idle --> GameJamDungeon_EnemyLogic_State_Idle : PatrolToRandomSpot
GameJamDungeon_EnemyLogic_State_Idle --> GameJamDungeon_EnemyLogic_State_Idle : PhysicsTick GameJamDungeon_EnemyLogic_State_Idle --> GameJamDungeon_EnemyLogic_State_Idle : PhysicsTick
GameJamDungeon_EnemyLogic_State_Alive : OnAttackTimer → Attack
GameJamDungeon_EnemyLogic_State_Alive : OnEnemyDefeated → Defeated
GameJamDungeon_EnemyLogic_State_Alive : OnHitByPlayer → HitByPlayer GameJamDungeon_EnemyLogic_State_Alive : OnHitByPlayer → HitByPlayer
GameJamDungeon_EnemyLogic_State_FollowPlayer : OnPhysicsTick → MovementComputed
GameJamDungeon_EnemyLogic_State_Idle : OnPhysicsTick → MovementComputed GameJamDungeon_EnemyLogic_State_Idle : OnPhysicsTick → MovementComputed
[*] --> GameJamDungeon_EnemyLogic_State_Idle [*] --> GameJamDungeon_EnemyLogic_State_Idle

View File

@@ -8,7 +8,7 @@ namespace GameJamDungeon
public partial record State public partial record State
{ {
[Meta, Id("enemy_logic_state_alive")] [Meta, Id("enemy_logic_state_alive")]
public abstract partial record Alive : State, IGet<Input.HitByPlayer>, IGet<Input.AttackTimer> public abstract partial record Alive : State, IGet<Input.HitByPlayer>, IGet<Input.AttackTimer>, IGet<Input.EnemyDefeated>
{ {
public Transition On(in Input.HitByPlayer input) public Transition On(in Input.HitByPlayer input)
{ {
@@ -24,7 +24,14 @@ namespace GameJamDungeon
public Transition On(in Input.AttackTimer input) public Transition On(in Input.AttackTimer input)
{ {
return To<Attack>(); Output(new Output.Attack());
return ToSelf();
}
public Transition On(in Input.EnemyDefeated input)
{
Output(new Output.Defeated());
return To<Defeated>();
} }
} }
} }

View File

@@ -1,37 +0,0 @@
using Chickensoft.GodotNodeInterfaces;
using Chickensoft.Introspection;
using Chickensoft.LogicBlocks;
using Godot;
namespace GameJamDungeon
{
public partial class EnemyLogic
{
public partial record State
{
[Meta, Id("enemy_logic_state_attack")]
public partial record Attack : Alive, IGet<Input.Alerted>
{
public Attack()
{
this.OnEnter(() =>
{
});
this.OnExit(() =>
{
});
}
public Transition On(in Input.Alerted input)
{
return To<FollowPlayer>();
}
private void AnimationPlayer_AnimationFinished(StringName animName)
{
Get<IEnemy>().EnemyLogic.Input(new Input.Alerted());
}
}
}
}
}

View File

@@ -0,0 +1,15 @@
using Chickensoft.Introspection;
using static GameJamDungeon.EnemyLogic.Input;
namespace GameJamDungeon;
public partial class EnemyLogic
{
public partial record State
{
[Meta, Id("enemy_logic_state_defeated")]
public partial record Defeated : State
{
}
}
}

View File

@@ -12,29 +12,17 @@ namespace GameJamDungeon
{ {
public Transition On(in Input.PhysicsTick input) public Transition On(in Input.PhysicsTick input)
{ {
//var delta = input.Delta; var delta = input.Delta;
//var gameRepo = Get<IGameRepo>(); var enemy = Get<IEnemy>();
//var enemy = Get<IEnemy>(); var gameRepo = Get<IGameRepo>();
var target = gameRepo.PlayerGlobalPosition.Value;
enemy.NavAgent.TargetPosition = target;
var targetPosition = enemy.NavAgent.GetNextPathPosition();
//if (enemy.GlobalPosition.DistanceTo(gameRepo.PlayerGlobalPosition.Value) <= 2.5f) enemy.Velocity = (targetPosition - enemy.GlobalTransform.Origin).Normalized() * 2f;
//{ enemy.Rotation = new Vector3(0, (float)Mathf.LerpAngle(enemy.Rotation.Y, Mathf.Atan2(enemy.Velocity.X, enemy.Velocity.Z), delta * 10.0), 0);
// //enemy.LookAt(-new Vector3(gameRepo.PlayerGlobalPosition.Value.X, enemy.GlobalPosition.Y, gameRepo.PlayerGlobalPosition.Value.Z), Vector3.Back);
// return ToSelf();
//}
//if (enemy.GlobalPosition.DistanceTo(gameRepo.PlayerGlobalPosition.Value) > 20f)
// return To<Idle>();
//enemy.NavAgent.TargetPosition = gameRepo.PlayerGlobalPosition.Value;
//var nextPosition = enemy.NavAgent.GetNextPathPosition();
//var lookAtPos = enemy.NavAgent.GetNextPathPosition();
////enemy.LookAt(-new Vector3(lookAtPos.X, enemy.GlobalPosition.Y, lookAtPos.Z), Vector3.Back);
//var direction = enemy.NavAgent.GetNextPathPosition() - enemy.GlobalPosition;
//enemy.Velocity = enemy.Velocity.MoveToward(direction.Normalized() * 0.01f, (float)delta);
//Output(new Output.MovementComputed(enemy.Velocity));
Output(new Output.MovementComputed());
return ToSelf(); return ToSelf();
} }

View File

@@ -20,8 +20,8 @@ public partial class EnemyLogic
var delta = input.Delta; var delta = input.Delta;
var enemy = Get<IEnemy>(); var enemy = Get<IEnemy>();
var targetPosition = enemy.NavAgent.GetNextPathPosition(); var targetPosition = enemy.NavAgent.GetNextPathPosition();
var velocity = (targetPosition - enemy.GlobalPosition).Normalized() * 3.0f;
enemy.Velocity = (targetPosition - enemy.GlobalTransform.Origin).Normalized() * 3.0f; enemy.Velocity = velocity;
enemy.Rotation = new Vector3(0, (float)Mathf.LerpAngle(enemy.Rotation.Y, Mathf.Atan2(enemy.Velocity.X, enemy.Velocity.Z), delta * 10.0), 0); enemy.Rotation = new Vector3(0, (float)Mathf.LerpAngle(enemy.Rotation.Y, Mathf.Atan2(enemy.Velocity.X, enemy.Velocity.Z), delta * 10.0), 0);
Output(new Output.MovementComputed()); Output(new Output.MovementComputed());

View File

@@ -1,4 +1,4 @@
[gd_resource type="Resource" script_class="WeaponInfo" load_steps=3 format=3 uid="uid://c1bg0o7nmu2xw"] [gd_resource type="Resource" script_class="WeaponStats" load_steps=3 format=3 uid="uid://c1bg0o7nmu2xw"]
[ext_resource type="Texture2D" uid="uid://cil3xe3jq82r6" path="res://src/items/weapons/textures/JIBLETT.PNG" id="1_ifm43"] [ext_resource type="Texture2D" uid="uid://cil3xe3jq82r6" path="res://src/items/weapons/textures/JIBLETT.PNG" id="1_ifm43"]
[ext_resource type="Script" path="res://src/items/weapons/WeaponStats.cs" id="1_re512"] [ext_resource type="Script" path="res://src/items/weapons/WeaponStats.cs" id="1_re512"]

View File

@@ -1,4 +1,4 @@
[gd_resource type="Resource" script_class="WeaponInfo" load_steps=3 format=3 uid="uid://bpdbuf0k0exb5"] [gd_resource type="Resource" script_class="WeaponStats" load_steps=3 format=3 uid="uid://bpdbuf0k0exb5"]
[ext_resource type="Script" path="res://src/items/weapons/WeaponStats.cs" id="1_cik6n"] [ext_resource type="Script" path="res://src/items/weapons/WeaponStats.cs" id="1_cik6n"]
[ext_resource type="Texture2D" uid="uid://cvtcsi2sagfwm" path="res://src/items/weapons/textures/SWAN SWORD.PNG" id="1_qc4eu"] [ext_resource type="Texture2D" uid="uid://cvtcsi2sagfwm" path="res://src/items/weapons/textures/SWAN SWORD.PNG" id="1_qc4eu"]
@@ -20,4 +20,4 @@ Ignores Affinity.
The blade of a thousand faced heroine." The blade of a thousand faced heroine."
Texture = ExtResource("1_qc4eu") Texture = ExtResource("1_qc4eu")
SpawnRate = 0.5 SpawnRate = 0.01

View File

@@ -1,8 +1,7 @@
[gd_scene load_steps=5 format=3 uid="uid://by67pn7fdsg1m"] [gd_scene load_steps=4 format=3 uid="uid://by67pn7fdsg1m"]
[ext_resource type="PackedScene" uid="uid://dvnc26rebk6o0" path="res://src/map/overworld/Overworld.tscn" id="1_ope1x"] [ext_resource type="PackedScene" uid="uid://dvnc26rebk6o0" path="res://src/map/overworld/Overworld.tscn" id="1_ope1x"]
[ext_resource type="PackedScene" uid="uid://bc1sp6xwe0j65" path="res://src/map/dungeon/floors/Floor1.tscn" id="2_merfv"] [ext_resource type="PackedScene" uid="uid://bc1sp6xwe0j65" path="res://src/map/dungeon/floors/Floor1.tscn" id="2_merfv"]
[ext_resource type="PackedScene" uid="uid://dcgj5i52i76gj" path="res://src/enemy/enemy_types/michael/Michael.tscn" id="4_d4sw2"]
[ext_resource type="PackedScene" uid="uid://bjqgl5u05ia04" path="res://src/map/dungeon/Teleport.tscn" id="5_jiohg"] [ext_resource type="PackedScene" uid="uid://bjqgl5u05ia04" path="res://src/map/dungeon/Teleport.tscn" id="5_jiohg"]
[node name="Map" type="Node3D"] [node name="Map" type="Node3D"]
@@ -24,6 +23,3 @@ unique_name_in_owner = true
process_mode = 3 process_mode = 3
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 900, 900, 900) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 900, 900, 900)
disable_mode = 2 disable_mode = 2
[node name="Michael" parent="." instance=ExtResource("4_d4sw2")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4.75859, 2.28929, -4.31558)

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=76 format=4 uid="uid://dpec2lbt83dhe"] [gd_scene load_steps=80 format=4 uid="uid://dpec2lbt83dhe"]
[ext_resource type="Script" path="res://addons/SimpleDungeons/DungeonRoom3D.gd" id="1_ho6e8"] [ext_resource type="Script" path="res://addons/SimpleDungeons/DungeonRoom3D.gd" id="1_ho6e8"]
[ext_resource type="Script" path="res://src/map/dungeon/code/DungeonRoom.cs" id="2_iwuh7"] [ext_resource type="Script" path="res://src/map/dungeon/code/DungeonRoom.cs" id="2_iwuh7"]
@@ -18,6 +18,7 @@
[ext_resource type="Texture2D" uid="uid://dn3c4nfpobdcs" path="res://src/map/dungeon/models/test/V2 Test1_CHAIN_TEX_13.png" id="16_lp3wx"] [ext_resource type="Texture2D" uid="uid://dn3c4nfpobdcs" path="res://src/map/dungeon/models/test/V2 Test1_CHAIN_TEX_13.png" id="16_lp3wx"]
[ext_resource type="PackedScene" uid="uid://twrj4wixcbu7" path="res://src/items/ItemDatabase.tscn" id="17_25wvm"] [ext_resource type="PackedScene" uid="uid://twrj4wixcbu7" path="res://src/items/ItemDatabase.tscn" id="17_25wvm"]
[ext_resource type="PackedScene" uid="uid://dbvr8ewajja6a" path="res://src/enemy/EnemyDatabase.tscn" id="18_v6hub"] [ext_resource type="PackedScene" uid="uid://dbvr8ewajja6a" path="res://src/enemy/EnemyDatabase.tscn" id="18_v6hub"]
[ext_resource type="Texture2D" uid="uid://0idh4qh35cp7" path="res://src/map/dungeon/corridor/CORRIDOR test_FLOOR1.jpg" id="19_06gih"]
[sub_resource type="NavigationMesh" id="NavigationMesh_2x5qh"] [sub_resource type="NavigationMesh" id="NavigationMesh_2x5qh"]
cell_size = 0.15 cell_size = 0.15
@@ -1024,6 +1025,15 @@ shadow_mesh = SubResource("ArrayMesh_oxoef")
[sub_resource type="PlaneMesh" id="PlaneMesh_bbi7v"] [sub_resource type="PlaneMesh" id="PlaneMesh_bbi7v"]
size = Vector2(35, 30) size = Vector2(35, 30)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_51rrf"]
albedo_texture = ExtResource("19_06gih")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_alrge"]
albedo_texture = ExtResource("19_06gih")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_x3ul8"]
albedo_texture = ExtResource("19_06gih")
[node name="Antechamber" type="Node3D"] [node name="Antechamber" type="Node3D"]
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 1.73082, 0, -1.86841) transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 1.73082, 0, -1.86841)
script = ExtResource("1_ho6e8") script = ExtResource("1_ho6e8")
@@ -1299,11 +1309,28 @@ SpawnRate = PackedFloat32Array(1)
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 29.876, -4.13235, -18.2257) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 29.876, -4.13235, -18.2257)
[node name="DOOR1" type="Marker3D" parent="Room"] [node name="DOOR?2" type="Marker3D" parent="Room"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 34.8732, -2.45415, -21.4188)
[node name="DOOR3" type="Marker3D" parent="Room"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 34.8732, -2.84773, -6.49106) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 34.8732, -2.84773, -6.49106)
[node name="DOOR2" type="Marker3D" parent="Room"] [node name="DOOR?3" type="Marker3D" parent="Room"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 10.7784, -2.45185, -14.7063) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 10.7784, -2.45185, -14.7063)
[node name="CSGBox" type="CSGBox3D" parent="."]
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 12.1009, 0.134912, -8.06366)
size = Vector3(4, 4, 0.5)
material = SubResource("StandardMaterial3D_51rrf")
[node name="CSGBox3D2" type="CSGBox3D" parent="CSGBox"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.1527)
visible = false
material_override = SubResource("StandardMaterial3D_alrge")
operation = 2
size = Vector3(4, 4, 0.5)
[node name="DOOR?1" type="CSGBox3D" parent="CSGBox"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.0686455)
visible = false
material_override = SubResource("StandardMaterial3D_alrge")
operation = 2
size = Vector3(4, 4, 2)
material = SubResource("StandardMaterial3D_x3ul8")

File diff suppressed because one or more lines are too long

View File

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

@@ -2,27 +2,26 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://t7fbfplu2js7" uid="uid://xuftapgcwb7n"
path.s3tc="res://.godot/imported/ROYAL_RAT_PRINCEP.png-e4eeb4a5bba938a6dc238bcabe55375f.s3tc.ctex" path="res://.godot/imported/ROYAL_RAT_PRINCEP.png-1c9df65d820f661e93d90926b6a342f0.ctex"
metadata={ metadata={
"imported_formats": ["s3tc_bptc"], "vram_texture": false
"vram_texture": true
} }
[deps] [deps]
source_file="res://src/npc/rat/ROYAL_RAT_PRINCEP.png" source_file="res://src/npc/ROYAL_RAT_PRINCEP.png"
dest_files=["res://.godot/imported/ROYAL_RAT_PRINCEP.png-e4eeb4a5bba938a6dc238bcabe55375f.s3tc.ctex"] dest_files=["res://.godot/imported/ROYAL_RAT_PRINCEP.png-1c9df65d820f661e93d90926b6a342f0.ctex"]
[params] [params]
compress/mode=2 compress/mode=0
compress/high_quality=false compress/high_quality=false
compress/lossy_quality=0.7 compress/lossy_quality=0.7
compress/hdr_compression=1 compress/hdr_compression=1
compress/normal_map=0 compress/normal_map=0
compress/channel_pack=0 compress/channel_pack=0
mipmaps/generate=true mipmaps/generate=false
mipmaps/limit=-1 mipmaps/limit=-1
roughness/mode=0 roughness/mode=0
roughness/src_normal="" roughness/src_normal=""

View File

@@ -1,8 +1,8 @@
[gd_scene load_steps=7 format=3 uid="uid://d4l4qutp8x40c"] [gd_scene load_steps=7 format=3 uid="uid://d4l4qutp8x40c"]
[ext_resource type="Texture2D" uid="uid://t7fbfplu2js7" path="res://src/npc/rat/ROYAL_RAT_PRINCEP.png" id="1_0r0wh"]
[ext_resource type="Script" path="res://src/npc/Npc.cs" id="1_cpdf2"] [ext_resource type="Script" path="res://src/npc/Npc.cs" id="1_cpdf2"]
[ext_resource type="Resource" uid="uid://cf7ycgdiihyh" path="res://src/npc/rat/ratdialogue.dialogue" id="2_uo38w"] [ext_resource type="Resource" uid="uid://cf7ycgdiihyh" path="res://src/npc/rat/ratdialogue.dialogue" id="2_uo38w"]
[ext_resource type="Texture2D" uid="uid://xuftapgcwb7n" path="res://src/npc/ROYAL_RAT_PRINCEP.png" id="3_p4ckb"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_wfhgc"] [sub_resource type="CylinderShape3D" id="CylinderShape3D_wfhgc"]
radius = 3.0 radius = 3.0
@@ -26,7 +26,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1, 0)
gi_mode = 0 gi_mode = 0
billboard = 2 billboard = 2
texture_filter = 0 texture_filter = 0
texture = ExtResource("1_0r0wh") texture = ExtResource("3_p4ckb")
[node name="DialogueZone" type="Area3D" parent="."] [node name="DialogueZone" type="Area3D" parent="."]
unique_name_in_owner = true unique_name_in_owner = true

View File

@@ -1,8 +1,6 @@
using Chickensoft.AutoInject; using Chickensoft.AutoInject;
using Chickensoft.Collections;
using Chickensoft.GodotNodeInterfaces; using Chickensoft.GodotNodeInterfaces;
using Chickensoft.Introspection; using Chickensoft.Introspection;
using Chickensoft.LogicBlocks;
using Chickensoft.SaveFileBuilder; using Chickensoft.SaveFileBuilder;
using Godot; using Godot;
@@ -67,6 +65,8 @@ namespace GameJamDungeon
private PlayerData PlayerData { get; set; } = default!; private PlayerData PlayerData { get; set; } = default!;
private bool flipAttack = false;
public void Initialize() public void Initialize()
{ {
AnimationPlayer.AnimationFinished += OnAnimationFinished; AnimationPlayer.AnimationFinished += OnAnimationFinished;
@@ -122,8 +122,8 @@ namespace GameJamDungeon
{ {
var attackSpeed = PlayerData.Inventory.EquippedWeapon.Value.WeaponStats.AttackSpeed; var attackSpeed = PlayerData.Inventory.EquippedWeapon.Value.WeaponStats.AttackSpeed;
AnimationPlayer.SetSpeedScale((float)attackSpeed); AnimationPlayer.SetSpeedScale((float)attackSpeed);
AnimationPlayer.Play("attack"); AnimationPlayer.Play("attack");
SwordSlashAnimation.Play("attack");
}) })
.Handle((in PlayerLogic.Output.ThrowItem output) => .Handle((in PlayerLogic.Output.ThrowItem output) =>
{ {

View File

@@ -1,9 +1,10 @@
[gd_scene load_steps=34 format=3 uid="uid://cfecvvav8kkp6"] [gd_scene load_steps=46 format=3 uid="uid://cfecvvav8kkp6"]
[ext_resource type="Script" path="res://src/player/Player.cs" id="1_xcol5"] [ext_resource type="Script" path="res://src/player/Player.cs" id="1_xcol5"]
[ext_resource type="Script" path="res://src/hitbox/Hitbox.cs" id="2_lb3qc"] [ext_resource type="Script" path="res://src/hitbox/Hitbox.cs" id="2_lb3qc"]
[ext_resource type="Script" path="res://src/player/PlayerStatResource.cs" id="2_xq68d"] [ext_resource type="Script" path="res://src/player/PlayerStatResource.cs" id="2_xq68d"]
[ext_resource type="Texture2D" uid="uid://c6r3dhnkuw22w" path="res://src/vfx/Weapon Strikes/FIRE_STRIKE_1.0.png" id="5_wr6lo"] [ext_resource type="Texture2D" uid="uid://c6r3dhnkuw22w" path="res://src/vfx/hit_effects/FIRE_STRIKE_1.0.png" id="5_wr6lo"]
[ext_resource type="Texture2D" uid="uid://b5qjlbcesth53" path="res://src/vfx/Weapon Strikes/NON ELEMENTAL SLASH.png" id="6_p34sl"]
[ext_resource type="PackedScene" uid="uid://ctwtksu2406c" path="res://src/player/dont_look_in_here/player_model.tscn" id="10_prmgx"] [ext_resource type="PackedScene" uid="uid://ctwtksu2406c" path="res://src/player/dont_look_in_here/player_model.tscn" id="10_prmgx"]
[sub_resource type="Resource" id="Resource_btp2w"] [sub_resource type="Resource" id="Resource_btp2w"]
@@ -48,10 +49,23 @@ tracks/0/keys = {
"update": 1, "update": 1,
"values": [true] "values": [true]
} }
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("SwordSlashAnimation:frame")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [0]
}
[sub_resource type="Animation" id="Animation_0jjwv"] [sub_resource type="Animation" id="Animation_0jjwv"]
resource_name = "attack" resource_name = "attack"
length = 0.7 length = 0.916675
step = 0.0833333
tracks/0/type = "value" tracks/0/type = "value"
tracks/0/imported = false tracks/0/imported = false
tracks/0/enabled = true tracks/0/enabled = true
@@ -59,18 +73,76 @@ tracks/0/path = NodePath("Hitbox/HitboxCollision:disabled")
tracks/0/interp = 1 tracks/0/interp = 1
tracks/0/loop_wrap = true tracks/0/loop_wrap = true
tracks/0/keys = { tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1667, 0.3333), "times": PackedFloat32Array(0, 0.0833333, 0.333333),
"transitions": PackedFloat32Array(1, 1, 1), "transitions": PackedFloat32Array(1, 1, 1),
"update": 1, "update": 1,
"values": [true, false, true] "values": [true, false, true]
} }
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("SwordSlashAnimation:frame")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.0833333, 0.166667, 0.25, 0.333333, 0.416667, 0.5, 0.583333, 0.666667, 0.75, 0.833333, 0.916666),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
}
[sub_resource type="Animation" id="Animation_uxo8q"]
resource_name = "explosion"
length = 3.66668
step = 0.0833333
[sub_resource type="AnimationLibrary" id="AnimationLibrary_w8l8m"] [sub_resource type="AnimationLibrary" id="AnimationLibrary_w8l8m"]
_data = { _data = {
"RESET": SubResource("Animation_hcjph"), "RESET": SubResource("Animation_hcjph"),
"attack": SubResource("Animation_0jjwv") "attack": SubResource("Animation_0jjwv"),
"explosion": SubResource("Animation_uxo8q")
} }
[sub_resource type="AtlasTexture" id="AtlasTexture_irupf"]
atlas = ExtResource("6_p34sl")
region = Rect2(300, 0, 300, 300)
[sub_resource type="AtlasTexture" id="AtlasTexture_63m7j"]
atlas = ExtResource("6_p34sl")
region = Rect2(600, 0, 300, 300)
[sub_resource type="AtlasTexture" id="AtlasTexture_1ypgu"]
atlas = ExtResource("6_p34sl")
region = Rect2(900, 0, 300, 300)
[sub_resource type="AtlasTexture" id="AtlasTexture_d7qd7"]
atlas = ExtResource("6_p34sl")
region = Rect2(1200, 0, 300, 300)
[sub_resource type="AtlasTexture" id="AtlasTexture_7heog"]
atlas = ExtResource("6_p34sl")
region = Rect2(1500, 0, 300, 300)
[sub_resource type="AtlasTexture" id="AtlasTexture_x4mbv"]
atlas = ExtResource("6_p34sl")
region = Rect2(1800, 0, 300, 300)
[sub_resource type="AtlasTexture" id="AtlasTexture_f7ysd"]
atlas = ExtResource("6_p34sl")
region = Rect2(2100, 0, 300, 300)
[sub_resource type="AtlasTexture" id="AtlasTexture_i2p57"]
atlas = ExtResource("6_p34sl")
region = Rect2(2400, 0, 300, 300)
[sub_resource type="AtlasTexture" id="AtlasTexture_tfnlg"]
atlas = ExtResource("6_p34sl")
region = Rect2(2700, 0, 300, 300)
[sub_resource type="AtlasTexture" id="AtlasTexture_gvgtb"]
atlas = ExtResource("6_p34sl")
region = Rect2(3000, 0, 300, 300)
[sub_resource type="AtlasTexture" id="AtlasTexture_fha34"] [sub_resource type="AtlasTexture" id="AtlasTexture_fha34"]
atlas = ExtResource("5_wr6lo") atlas = ExtResource("5_wr6lo")
region = Rect2(0, 0, 450, 450) region = Rect2(0, 0, 450, 450)
@@ -155,6 +227,47 @@ region = Rect2(1800, 450, 450, 450)
animations = [{ animations = [{
"frames": [{ "frames": [{
"duration": 1.0, "duration": 1.0,
"texture": null
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_irupf")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_63m7j")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_1ypgu")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_d7qd7")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_7heog")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_x4mbv")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_f7ysd")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_i2p57")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_tfnlg")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_gvgtb")
}, {
"duration": 1.0,
"texture": null
}],
"loop": false,
"name": &"attack",
"speed": 12.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_fha34") "texture": SubResource("AtlasTexture_fha34")
}, { }, {
"duration": 1.0, "duration": 1.0,
@@ -218,7 +331,12 @@ animations = [{
"texture": null "texture": null
}], }],
"loop": false, "loop": false,
"name": &"attack", "name": &"attack_fire",
"speed": 12.0
}, {
"frames": [],
"loop": true,
"name": &"attack_water",
"speed": 12.0 "speed": 12.0
}] }]
@@ -281,8 +399,9 @@ visible = false
[node name="SwordSlashAnimation" type="AnimatedSprite2D" parent="."] [node name="SwordSlashAnimation" type="AnimatedSprite2D" parent="."]
unique_name_in_owner = true unique_name_in_owner = true
texture_filter = 1 texture_filter = 1
position = Vector2(900, 565) position = Vector2(983, 555)
scale = Vector2(1.8, 1.8) scale = Vector2(3, 3)
sprite_frames = SubResource("SpriteFrames_ywvvo") sprite_frames = SubResource("SpriteFrames_ywvvo")
animation = &"attack" animation = &"attack"
frame = 6 flip_h = true
flip_v = true

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b5qjlbcesth53"
path="res://.godot/imported/NON ELEMENTAL SLASH.png-1bf909eeddb451e3f6e33c698e2e53e1.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://src/vfx/Weapon Strikes/NON ELEMENTAL SLASH.png"
dest_files=["res://.godot/imported/NON ELEMENTAL SLASH.png-1bf909eeddb451e3f6e33c698e2e53e1.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=0

View File

Before

Width:  |  Height:  |  Size: 452 KiB

After

Width:  |  Height:  |  Size: 452 KiB

View File

@@ -3,15 +3,15 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://c6r3dhnkuw22w" uid="uid://c6r3dhnkuw22w"
path="res://.godot/imported/FIRE_STRIKE_1.0.png-99f3e00032e79a9fb3eea29378859d3a.ctex" path="res://.godot/imported/FIRE_STRIKE_1.0.png-559ebdca8bed9db1db96b1d1b2d8f353.ctex"
metadata={ metadata={
"vram_texture": false "vram_texture": false
} }
[deps] [deps]
source_file="res://src/vfx/Weapon Strikes/FIRE_STRIKE_1.0.png" source_file="res://src/vfx/hit_effects/FIRE_STRIKE_1.0.png"
dest_files=["res://.godot/imported/FIRE_STRIKE_1.0.png-99f3e00032e79a9fb3eea29378859d3a.ctex"] dest_files=["res://.godot/imported/FIRE_STRIKE_1.0.png-559ebdca8bed9db1db96b1d1b2d8f353.ctex"]
[params] [params]

View File

Before

Width:  |  Height:  |  Size: 652 KiB

After

Width:  |  Height:  |  Size: 652 KiB

View File

@@ -3,15 +3,15 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://dw41v352onc0a" uid="uid://dw41v352onc0a"
path="res://.godot/imported/WATER_STRIKE_1.0.png-a6edb07d301bc64df48872862f6459ee.ctex" path="res://.godot/imported/WATER_STRIKE_1.0.png-e7137b942ece3c27aab46a2703843a54.ctex"
metadata={ metadata={
"vram_texture": false "vram_texture": false
} }
[deps] [deps]
source_file="res://src/vfx/Weapon Strikes/WATER_STRIKE_1.0.png" source_file="res://src/vfx/hit_effects/WATER_STRIKE_1.0.png"
dest_files=["res://.godot/imported/WATER_STRIKE_1.0.png-a6edb07d301bc64df48872862f6459ee.ctex"] dest_files=["res://.godot/imported/WATER_STRIKE_1.0.png-e7137b942ece3c27aab46a2703843a54.ctex"]
[params] [params]

Binary file not shown.

After

Width:  |  Height:  |  Size: 488 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://npwcgmo2hi1t"
path="res://.godot/imported/explosion.png-8174f81734413e849902e37c0ddda01d.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://src/vfx/hit_effects/explosion.png"
dest_files=["res://.godot/imported/explosion.png-8174f81734413e849902e37c0ddda01d.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=0

View File

@@ -0,0 +1,29 @@
shader_type canvas_item;
/**
Color to use for the shock.
*/
uniform vec3 shock_color : source_color = vec3(1.0, 0.0, 0.0);
/**
Initial amplitude of the shock. This will start at this amplitude and
gradually attenuate.
*/
uniform float amplitude = 30.0;
uniform float progress: hint_range(0.0, 1.0) = -1.0;
/**
How fast shold it move side to side, more frequency means it'll move more quickly
side to side.
*/
uniform float frequecy = 10.0;
void vertex() {
float exponent = mod(progress, 3.0);
VERTEX.x += amplitude * exp(-3.0*exponent) * sin(frequecy*exponent);
}
void fragment() {
float exponent = mod(progress, 3.0);
vec3 normal_color = texture(TEXTURE, UV).rgb;
COLOR.rgb = normal_color + shock_color * exp(-3.0*exponent);
}

View File

@@ -0,0 +1,3 @@
[gd_resource type="ShaderMaterial" format=3 uid="uid://c0gpeve05njqq"]
[resource]

View File

@@ -0,0 +1,28 @@
shader_type canvas_item;
// Animate from 0 to 1
uniform float progress: hint_range(0.0, 1.0) = 0.0;
// How jagged each band of melting pixels are
uniform float meltiness: hint_range(0.0, 16.0) = 1.0;
float psuedo_rand(float x) {
return mod(x * 2048103.0 + cos(x * 1912.0), 1.0);
}
void fragment() {
vec2 uv = UV;
// Move pixels near the top faster
uv.y -= progress / UV.y;
// Created jagged edges for each pixel on the x-axis
uv.y -= progress * meltiness * psuedo_rand(UV.x - mod(UV.x, TEXTURE_PIXEL_SIZE.x));
COLOR = texture(TEXTURE, uv);
// "delete" pixels out of range
if (uv.y <= 0.0) {
COLOR.a = 0.0;
}
}

View File

@@ -0,0 +1,10 @@
[gd_resource type="ShaderMaterial" load_steps=2 format=3 uid="uid://yvt4d1xnftll"]
[ext_resource type="Shader" path="res://src/vfx/shaders/DamageHit.gdshader" id="1_a8e00"]
[resource]
shader = ExtResource("1_a8e00")
shader_parameter/shock_color = Color(1, 0, 0, 1)
shader_parameter/amplitude = 30.0
shader_parameter/progress = 0.0
shader_parameter/frequecy = 10.0