centurion and legionary enemies

pull/6/head
John Montagu, the 4th Earl of Sandvich 2023-08-08 00:54:00 -07:00
parent 95e323ed63
commit 9a3d6fa8e4
Signed by: sandvich
GPG Key ID: 9A39BE37E602B22D
64 changed files with 2293 additions and 106 deletions

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://5fybh24xashp"
path="res://.godot/imported/shotgun.wav-534a563afe0baae28e1f7171107beab0.sample"
[deps]
source_file="res://Assets/Sounds/shotgun.wav"
dest_files=["res://.godot/imported/shotgun.wav-534a563afe0baae28e1f7171107beab0.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 914 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cfyd6sv4yeplt"
path="res://.godot/imported/doc-centurion.png-c338efa15de1dcb536f9d92bf71e8760.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Sprites/Characters/doc-centurion.png"
dest_files=["res://.godot/imported/doc-centurion.png-c338efa15de1dcb536f9d92bf71e8760.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: 547 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://byseosv8hwgg7"
path="res://.godot/imported/doc-knight.png-6234ac8c9efcb03f74510b500e695043.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Sprites/Characters/doc-knight.png"
dest_files=["res://.godot/imported/doc-knight.png-6234ac8c9efcb03f74510b500e695043.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: 802 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://khq0ujwl6xrt"
path="res://.godot/imported/doc-legionary.png-8f5899d31c08d0ed2ab7302c091c6dab.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Sprites/Characters/doc-legionary.png"
dest_files=["res://.godot/imported/doc-legionary.png-8f5899d31c08d0ed2ab7302c091c6dab.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: 184 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://417j1ckcjg2i"
path="res://.godot/imported/doc-shield.png-2a52fb5fee10b1e22bca5cf89c2678c2.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Sprites/Items/doc-shield.png"
dest_files=["res://.godot/imported/doc-shield.png-2a52fb5fee10b1e22bca5cf89c2678c2.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: 169 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dfpe74vxvuwal"
path="res://.godot/imported/pugio.png-fa7453f4b1eaf635e43eebc786b17fec.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Sprites/Items/pugio.png"
dest_files=["res://.godot/imported/pugio.png-fa7453f4b1eaf635e43eebc786b17fec.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: 137 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b1omx2kdb2x1n"
path="res://.godot/imported/shotgun.png-d8cfd36a55586388c595635947678d36.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Sprites/Items/shotgun.png"
dest_files=["res://.godot/imported/shotgun.png-d8cfd36a55586388c595635947678d36.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: 383 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dev6i1j37lauo"
path="res://.godot/imported/sword-swing-32.png-11d82306b8a2f9ee744192fd27b2bd25.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Sprites/sword-swing-32.png"
dest_files=["res://.godot/imported/sword-swing-32.png-11d82306b8a2f9ee744192fd27b2bd25.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: 444 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://ct0m4lk2icx3p"
path="res://.godot/imported/sword-swing-small.png-29f84988161446fee5ee3a6b6f1fbc14.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Sprites/sword-swing-small.png"
dest_files=["res://.godot/imported/sword-swing-small.png-29f84988161446fee5ee3a6b6f1fbc14.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

View File

@ -213,11 +213,11 @@ public partial class Character : CharacterBody2D, IFaction
if (Inventory.SelectedItem is Weapon weapon) if (Inventory.SelectedItem is Weapon weapon)
{ {
weapon.Use(); if (!weapon.IsUsing)
if (weapon.IsUsing)
{ {
Inventory.EmitSignal(Inventory.SignalName.UsedItem, weapon); Inventory.EmitSignal(Inventory.SignalName.UsedItem, weapon);
} }
weapon.Use();
} }
} }
@ -230,6 +230,27 @@ public partial class Character : CharacterBody2D, IFaction
} }
} }
public void UseCurrentItemAlt()
{
if (StunTime > 0 || !IsAlive)
{
return;
}
if (Inventory.SelectedItem is Weapon weapon)
{
weapon.UseAlt();
}
}
public void DeuseCurrentItemAlt()
{
if (Inventory.SelectedItem is Weapon weapon)
{
weapon.DeuseAlt();
}
}
public void LookTowardsDirection() public void LookTowardsDirection()
{ {
if (!Direction.IsZeroApprox()) if (!Direction.IsZeroApprox())
@ -343,8 +364,6 @@ public partial class Character : CharacterBody2D, IFaction
}; };
var spaceState = GetWorld2D().DirectSpaceState; var spaceState = GetWorld2D().DirectSpaceState;
var result = spaceState.IntersectRay(rayParams); var result = spaceState.IntersectRay(rayParams);
if (result.Count > 0)
GD.Print(result["collider"]);
return result.Count == 0; return result.Count == 0;
} }
} }

View File

@ -0,0 +1,420 @@
[gd_scene load_steps=41 format=3 uid="uid://dhamcei7tfta8"]
[ext_resource type="Shader" path="res://Shaders/Flash.gdshader" id="1_msit5"]
[ext_resource type="Script" path="res://Characters/Enemy.cs" id="2_pkari"]
[ext_resource type="Script" path="res://State/Character/CharacterStateMachine.cs" id="3_2dbgx"]
[ext_resource type="Script" path="res://State/Character/NPCIdleState.cs" id="4_47f2d"]
[ext_resource type="Script" path="res://State/Character/NPCMoveState.cs" id="5_iphm1"]
[ext_resource type="Script" path="res://State/Thinker/ThinkerStateMachine.cs" id="6_6516i"]
[ext_resource type="Script" path="res://State/Thinker/BlockAttackState.cs" id="7_vgjig"]
[ext_resource type="Script" path="res://State/Thinker/IdleState.cs" id="8_5neew"]
[ext_resource type="Script" path="res://Utils/AnimationManager.cs" id="9_fgnr2"]
[ext_resource type="Animation" uid="uid://8e8r3y1imvsx" path="res://Assets/Animations/stun.res" id="10_1erll"]
[ext_resource type="Material" uid="uid://bat28samf7ukd" path="res://Assets/Sprites/Particles/NPCDamageProcessMaterial.tres" id="11_p7yev"]
[ext_resource type="Texture2D" uid="uid://bd8l8kafb42dt" path="res://Assets/Sprites/Particles/circle.png" id="12_t3nnt"]
[ext_resource type="Material" uid="uid://2tsvsp45elru" path="res://Assets/Sprites/Particles/NPCDeathParticles.tres" id="13_nm3wd"]
[ext_resource type="Texture2D" uid="uid://c1a7lvb4uuwfy" path="res://Assets/Sprites/Particles/circle-16.png" id="14_o5rd3"]
[ext_resource type="AudioStream" uid="uid://k6kpdj1kv0jg" path="res://Assets/Sounds/splat.ogg" id="15_8yg1g"]
[ext_resource type="Texture2D" uid="uid://cfyd6sv4yeplt" path="res://Assets/Sprites/Characters/doc-centurion.png" id="16_6uxxp"]
[ext_resource type="Script" path="res://Items/Inventory.cs" id="17_6fh5y"]
[ext_resource type="PackedScene" uid="uid://5y1acxl4j4n7" path="res://Items/Weapons/Pugio.tscn" id="18_7l8tj"]
[ext_resource type="PackedScene" uid="uid://cjgxyhgcyvsv7" path="res://BoundingBoxes/Hurtbox.tscn" id="19_xol7n"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_2fq6c"]
resource_local_to_scene = true
shader = ExtResource("1_msit5")
shader_parameter/color = Vector4(1, 1, 1, 1)
shader_parameter/intensity = 0.0
shader_parameter/alpha_modulate = 1.0
[sub_resource type="Animation" id="Animation_rqtrh"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("../Sprites/Node2D/Character:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [0]
}
[sub_resource type="Animation" id="Animation_qws2q"]
resource_name = "idle"
length = 0.8
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("../Sprites/Node2D/Character:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [0]
}
[sub_resource type="Animation" id="Animation_dwyme"]
resource_name = "move"
length = 0.6
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("../Sprites/Node2D/Character:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [1, 2, 3, 4, 5, 6]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_uqsue"]
_data = {
"RESET": SubResource("Animation_rqtrh"),
"idle": SubResource("Animation_qws2q"),
"move": SubResource("Animation_dwyme")
}
[sub_resource type="Animation" id="Animation_adxyh"]
resource_local_to_scene = true
length = 0.001
[sub_resource type="AnimationLibrary" id="AnimationLibrary_sxq14"]
_data = {
"RESET": SubResource("Animation_adxyh")
}
[sub_resource type="Animation" id="Animation_k6l16"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:material:shader_parameter/intensity")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.0]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:material:shader_parameter/alpha_modulate")
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("Effects/DeathParticles:emitting")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("Effects/HurtParticles:emitting")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
[sub_resource type="Animation" id="Animation_lhc4c"]
resource_name = "death"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Effects/DeathParticles:emitting")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:material:shader_parameter/alpha_modulate")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [1.0, 0.0]
}
[sub_resource type="Animation" id="Animation_0vgmg"]
resource_local_to_scene = true
resource_name = "hurt"
length = 0.2
step = 0.05
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:material:shader_parameter/intensity")
tracks/0/interp = 2
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.05, 0.1, 0.2),
"transitions": PackedFloat32Array(4, 4, 4, 4),
"update": 0,
"values": [1.0, 0.0, 1.0, 0.0]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Effects/HurtParticles:emitting")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/2/type = "method"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("Effects/HurtParticles")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0.1),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"restart"
}]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_rc55s"]
_data = {
"RESET": SubResource("Animation_k6l16"),
"death": SubResource("Animation_lhc4c"),
"hurt": SubResource("Animation_0vgmg")
}
[sub_resource type="Animation" id="Animation_7j54f"]
length = 0.001
[sub_resource type="AnimationLibrary" id="AnimationLibrary_kks2p"]
_data = {
"RESET": SubResource("Animation_7j54f"),
"stun": ExtResource("10_1erll")
}
[sub_resource type="CanvasTexture" id="CanvasTexture_pited"]
diffuse_texture = ExtResource("14_o5rd3")
[sub_resource type="Gradient" id="Gradient_b2o0f"]
colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 0)
[sub_resource type="GradientTexture1D" id="GradientTexture1D_iyaih"]
gradient = SubResource("Gradient_b2o0f")
[sub_resource type="Curve" id="Curve_30p4b"]
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.2, 1), 0.0, 0.0, 0, 0, Vector2(1, 0.5), 0.0, 0.0, 0, 0]
point_count = 3
[sub_resource type="CurveTexture" id="CurveTexture_5uulw"]
curve = SubResource("Curve_30p4b")
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_qdhau"]
particle_flag_disable_z = true
spread = 180.0
gravity = Vector3(0, 0, 0)
initial_velocity_min = 32.0
initial_velocity_max = 32.0
angular_velocity_min = 90.0
angular_velocity_max = 90.0
orbit_velocity_min = 0.0
orbit_velocity_max = 0.0
linear_accel_min = -64.0
linear_accel_max = -32.0
tangential_accel_min = 8.0
tangential_accel_max = 8.0
scale_min = 0.13
scale_max = 0.25
scale_curve = SubResource("CurveTexture_5uulw")
color = Color(1, 0, 0, 1)
color_ramp = SubResource("GradientTexture1D_iyaih")
[sub_resource type="RectangleShape2D" id="RectangleShape2D_bfqew"]
size = Vector2(12, 8)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_1gjgc"]
size = Vector2(12, 16)
[node name="Centurion" type="CharacterBody2D" node_paths=PackedStringArray("DefaultSelectedItem", "ThinkerStateMachine", "Sprite", "Inventory", "StateMachine", "Hurtbox")]
y_sort_enabled = true
texture_filter = 3
material = SubResource("ShaderMaterial_2fq6c")
collision_layer = 6
collision_mask = 17
script = ExtResource("2_pkari")
DefaultSelectedItem = NodePath("Inventory/Sword")
ThinkerStateMachine = NodePath("ThinkerStateMachine")
Speed = 40.0
Mass = 2.0
Health = 80.0
Sprite = NodePath("Sprites/Node2D/Character")
Inventory = NodePath("Inventory")
StateMachine = NodePath("StateMachine")
Hurtbox = NodePath("Hurtbox")
[node name="StateMachine" type="Node" parent="." node_paths=PackedStringArray("InitialState", "Character")]
script = ExtResource("3_2dbgx")
InitialState = NodePath("Idle")
Character = NodePath("..")
[node name="Idle" type="Node" parent="StateMachine" node_paths=PackedStringArray("MoveState", "Character")]
script = ExtResource("4_47f2d")
MoveState = NodePath("../Move")
Character = NodePath("../..")
[node name="Move" type="Node" parent="StateMachine" node_paths=PackedStringArray("IdleState", "Character")]
script = ExtResource("5_iphm1")
IdleState = NodePath("../Idle")
Character = NodePath("../..")
[node name="ThinkerStateMachine" type="Node" parent="." node_paths=PackedStringArray("InitialState")]
script = ExtResource("6_6516i")
InitialState = NodePath("Idle")
[node name="Attack" type="Node" parent="ThinkerStateMachine" node_paths=PackedStringArray("PassiveState", "PursueState", "NPC")]
script = ExtResource("7_vgjig")
PreferredWeightDistance = 24.0
MaxDistanceToTarget = 128.0
UseItemDistance = 48.0
PassiveState = NodePath("../Idle")
PursueState = NodePath("../Idle")
NPC = NodePath("../..")
[node name="Idle" type="Node" parent="ThinkerStateMachine" node_paths=PackedStringArray("PursueState", "NavigationAgent", "NPC")]
script = ExtResource("8_5neew")
PursueState = NodePath("../Attack")
MinTargetDistance = 24.0
PursueOnLineOfSight = true
MinLineOfSightDistance = 256.0
ShouldReturnToOriginalPosition = true
NavigationAgent = NodePath("../../NavigationAgent2D")
NPC = NodePath("../..")
[node name="NavigationAgent2D" type="NavigationAgent2D" parent="."]
target_desired_distance = 16.0
debug_enabled = true
[node name="Animations" type="Node" parent="."]
script = ExtResource("9_fgnr2")
[node name="Movement" type="AnimationPlayer" parent="Animations"]
libraries = {
"": SubResource("AnimationLibrary_uqsue")
}
[node name="Attack" type="AnimationPlayer" parent="Animations"]
libraries = {
"": SubResource("AnimationLibrary_sxq14")
}
[node name="Hurt" type="AnimationPlayer" parent="Animations"]
root_node = NodePath("../..")
libraries = {
"": SubResource("AnimationLibrary_rc55s")
}
[node name="Stun" type="AnimationPlayer" parent="Animations"]
libraries = {
"": SubResource("AnimationLibrary_kks2p")
}
[node name="Effects" type="Node2D" parent="."]
[node name="HurtParticles" type="GPUParticles2D" parent="Effects"]
position = Vector2(0, -8)
emitting = false
process_material = ExtResource("11_p7yev")
texture = ExtResource("12_t3nnt")
lifetime = 0.4
one_shot = true
explosiveness = 1.0
[node name="DeathParticles" type="GPUParticles2D" parent="Effects"]
emitting = false
amount = 32
process_material = ExtResource("13_nm3wd")
texture = SubResource("CanvasTexture_pited")
lifetime = 2.0
one_shot = true
preprocess = 0.1
explosiveness = 0.9
[node name="SpawnParticles" type="GPUParticles2D" parent="Effects"]
emitting = false
amount = 24
process_material = SubResource("ParticleProcessMaterial_qdhau")
texture = ExtResource("14_o5rd3")
[node name="HurtSound" type="AudioStreamPlayer2D" parent="Effects"]
stream = ExtResource("15_8yg1g")
[node name="Sprites" type="Node2D" parent="."]
y_sort_enabled = true
use_parent_material = true
position = Vector2(-0.5, 0)
rotation = 6.28319
[node name="Node2D" type="Node2D" parent="Sprites"]
use_parent_material = true
[node name="Character" type="Sprite2D" parent="Sprites/Node2D"]
use_parent_material = true
texture = ExtResource("16_6uxxp")
offset = Vector2(0, -12)
hframes = 7
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, -4)
shape = SubResource("RectangleShape2D_bfqew")
[node name="Inventory" type="Node2D" parent="."]
y_sort_enabled = true
position = Vector2(0, -4)
script = ExtResource("17_6fh5y")
[node name="Sword" parent="Inventory" instance=ExtResource("18_7l8tj")]
[node name="Hurtbox" parent="." instance=ExtResource("19_xol7n")]
[node name="CollisionShape2D" parent="Hurtbox" index="0"]
position = Vector2(0, -8)
shape = SubResource("RectangleShape2D_1gjgc")
[editable path="Hurtbox"]

View File

@ -0,0 +1,442 @@
[gd_scene load_steps=41 format=3 uid="uid://cdj50hb84aujp"]
[ext_resource type="Shader" path="res://Shaders/Flash.gdshader" id="1_hvgeb"]
[ext_resource type="Script" path="res://Characters/Enemy.cs" id="2_h5w5n"]
[ext_resource type="Script" path="res://State/Character/CharacterStateMachine.cs" id="3_04p3j"]
[ext_resource type="Script" path="res://State/Character/NPCIdleState.cs" id="4_1ngkf"]
[ext_resource type="Script" path="res://State/Character/NPCMoveState.cs" id="5_wcpa1"]
[ext_resource type="Script" path="res://State/Thinker/ThinkerStateMachine.cs" id="6_121gp"]
[ext_resource type="Script" path="res://State/Thinker/AttackState.cs" id="8_8a6v2"]
[ext_resource type="Script" path="res://State/Thinker/IdleState.cs" id="9_ewnq3"]
[ext_resource type="Script" path="res://Utils/AnimationManager.cs" id="9_ssmee"]
[ext_resource type="Animation" uid="uid://8e8r3y1imvsx" path="res://Assets/Animations/stun.res" id="10_oplmj"]
[ext_resource type="Material" uid="uid://bat28samf7ukd" path="res://Assets/Sprites/Particles/NPCDamageProcessMaterial.tres" id="11_qcw5x"]
[ext_resource type="Texture2D" uid="uid://bd8l8kafb42dt" path="res://Assets/Sprites/Particles/circle.png" id="12_rlelw"]
[ext_resource type="Material" uid="uid://2tsvsp45elru" path="res://Assets/Sprites/Particles/NPCDeathParticles.tres" id="13_kgmsk"]
[ext_resource type="Texture2D" uid="uid://c1a7lvb4uuwfy" path="res://Assets/Sprites/Particles/circle-16.png" id="14_88n3w"]
[ext_resource type="AudioStream" uid="uid://k6kpdj1kv0jg" path="res://Assets/Sounds/splat.ogg" id="15_w7mkq"]
[ext_resource type="Texture2D" uid="uid://khq0ujwl6xrt" path="res://Assets/Sprites/Characters/doc-legionary.png" id="16_vtfwo"]
[ext_resource type="Script" path="res://Items/Inventory.cs" id="17_5rur0"]
[ext_resource type="PackedScene" uid="uid://p7oijq6dbvvk" path="res://Items/Weapons/DocLance.tscn" id="18_jblpi"]
[ext_resource type="PackedScene" uid="uid://cjgxyhgcyvsv7" path="res://BoundingBoxes/Hurtbox.tscn" id="20_dwjfv"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_2fq6c"]
resource_local_to_scene = true
shader = ExtResource("1_hvgeb")
shader_parameter/color = Vector4(1, 1, 1, 1)
shader_parameter/intensity = 0.0
shader_parameter/alpha_modulate = 1.0
[sub_resource type="Animation" id="Animation_rqtrh"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("../Sprites/Node2D/Character:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [0]
}
[sub_resource type="Animation" id="Animation_qws2q"]
resource_name = "idle"
length = 0.8
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("../Sprites/Node2D/Character:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [0]
}
[sub_resource type="Animation" id="Animation_dwyme"]
resource_name = "move"
length = 0.6
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("../Sprites/Node2D/Character:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [1, 2, 3, 4, 5, 6]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_uqsue"]
_data = {
"RESET": SubResource("Animation_rqtrh"),
"idle": SubResource("Animation_qws2q"),
"move": SubResource("Animation_dwyme")
}
[sub_resource type="Animation" id="Animation_adxyh"]
resource_local_to_scene = true
length = 0.001
[sub_resource type="AnimationLibrary" id="AnimationLibrary_sxq14"]
_data = {
"RESET": SubResource("Animation_adxyh")
}
[sub_resource type="Animation" id="Animation_k6l16"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:material:shader_parameter/intensity")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.0]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:material:shader_parameter/alpha_modulate")
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("Effects/DeathParticles:emitting")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("Effects/HurtParticles:emitting")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("Sprites/Node2D/Character:frame")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [8]
}
[sub_resource type="Animation" id="Animation_lhc4c"]
resource_name = "death"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Effects/DeathParticles:emitting")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:material:shader_parameter/alpha_modulate")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [1.0, 0.0]
}
[sub_resource type="Animation" id="Animation_0vgmg"]
resource_local_to_scene = true
resource_name = "hurt"
length = 0.2
step = 0.05
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:material:shader_parameter/intensity")
tracks/0/interp = 2
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.05, 0.1, 0.2),
"transitions": PackedFloat32Array(4, 4, 4, 4),
"update": 0,
"values": [1.0, 0.0, 1.0, 0.0]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Effects/HurtParticles:emitting")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/2/type = "method"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("Effects/HurtParticles")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0.1),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"restart"
}]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = false
tracks/3/path = NodePath("Sprites/Node2D/Character:frame")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [8]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_rc55s"]
_data = {
"RESET": SubResource("Animation_k6l16"),
"death": SubResource("Animation_lhc4c"),
"hurt": SubResource("Animation_0vgmg")
}
[sub_resource type="Animation" id="Animation_7j54f"]
length = 0.001
[sub_resource type="AnimationLibrary" id="AnimationLibrary_kks2p"]
_data = {
"RESET": SubResource("Animation_7j54f"),
"stun": ExtResource("10_oplmj")
}
[sub_resource type="CanvasTexture" id="CanvasTexture_pited"]
diffuse_texture = ExtResource("14_88n3w")
[sub_resource type="Gradient" id="Gradient_b2o0f"]
colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 0)
[sub_resource type="GradientTexture1D" id="GradientTexture1D_iyaih"]
gradient = SubResource("Gradient_b2o0f")
[sub_resource type="Curve" id="Curve_30p4b"]
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.2, 1), 0.0, 0.0, 0, 0, Vector2(1, 0.5), 0.0, 0.0, 0, 0]
point_count = 3
[sub_resource type="CurveTexture" id="CurveTexture_5uulw"]
curve = SubResource("Curve_30p4b")
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_qdhau"]
particle_flag_disable_z = true
spread = 180.0
gravity = Vector3(0, 0, 0)
initial_velocity_min = 32.0
initial_velocity_max = 32.0
angular_velocity_min = 90.0
angular_velocity_max = 90.0
orbit_velocity_min = 0.0
orbit_velocity_max = 0.0
linear_accel_min = -64.0
linear_accel_max = -32.0
tangential_accel_min = 8.0
tangential_accel_max = 8.0
scale_min = 0.13
scale_max = 0.25
scale_curve = SubResource("CurveTexture_5uulw")
color = Color(1, 0, 0, 1)
color_ramp = SubResource("GradientTexture1D_iyaih")
[sub_resource type="RectangleShape2D" id="RectangleShape2D_bfqew"]
size = Vector2(12, 8)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_1gjgc"]
size = Vector2(12, 16)
[node name="Legionary" type="CharacterBody2D" node_paths=PackedStringArray("DefaultSelectedItem", "ThinkerStateMachine", "Sprite", "Inventory", "StateMachine", "Hurtbox")]
y_sort_enabled = true
texture_filter = 3
material = SubResource("ShaderMaterial_2fq6c")
collision_layer = 6
collision_mask = 17
script = ExtResource("2_h5w5n")
DefaultSelectedItem = NodePath("Inventory/DocLance")
ThinkerStateMachine = NodePath("ThinkerStateMachine")
Speed = 56.0
Health = 170.0
Sprite = NodePath("Sprites/Node2D/Character")
Inventory = NodePath("Inventory")
StateMachine = NodePath("StateMachine")
Hurtbox = NodePath("Hurtbox")
[node name="StateMachine" type="Node" parent="." node_paths=PackedStringArray("InitialState", "Character")]
script = ExtResource("3_04p3j")
InitialState = NodePath("Idle")
Character = NodePath("..")
[node name="Idle" type="Node" parent="StateMachine" node_paths=PackedStringArray("MoveState", "Character")]
script = ExtResource("4_1ngkf")
MoveState = NodePath("../Move")
Character = NodePath("../..")
[node name="Move" type="Node" parent="StateMachine" node_paths=PackedStringArray("IdleState", "Character")]
script = ExtResource("5_wcpa1")
IdleState = NodePath("../Idle")
Character = NodePath("../..")
[node name="ThinkerStateMachine" type="Node" parent="." node_paths=PackedStringArray("InitialState")]
script = ExtResource("6_121gp")
InitialState = NodePath("Idle")
[node name="Attack" type="Node" parent="ThinkerStateMachine" node_paths=PackedStringArray("PassiveState", "PursueState", "NPC")]
script = ExtResource("8_8a6v2")
MaxDistanceToTarget = 128.0
UseItemDistance = 64.0
PassiveState = NodePath("../Idle")
PursueState = NodePath("../Idle")
NPC = NodePath("../..")
[node name="Idle" type="Node" parent="ThinkerStateMachine" node_paths=PackedStringArray("PursueState", "NavigationAgent", "NPC")]
script = ExtResource("9_ewnq3")
PursueState = NodePath("../Attack")
MinTargetDistance = 24.0
PursueOnLineOfSight = true
MinLineOfSightDistance = 256.0
ShouldReturnToOriginalPosition = true
NavigationAgent = NodePath("../../NavigationAgent2D")
NPC = NodePath("../..")
[node name="NavigationAgent2D" type="NavigationAgent2D" parent="."]
target_desired_distance = 16.0
debug_enabled = true
[node name="Animations" type="Node" parent="."]
script = ExtResource("9_ssmee")
[node name="Movement" type="AnimationPlayer" parent="Animations"]
libraries = {
"": SubResource("AnimationLibrary_uqsue")
}
[node name="Attack" type="AnimationPlayer" parent="Animations"]
libraries = {
"": SubResource("AnimationLibrary_sxq14")
}
[node name="Hurt" type="AnimationPlayer" parent="Animations"]
root_node = NodePath("../..")
libraries = {
"": SubResource("AnimationLibrary_rc55s")
}
[node name="Stun" type="AnimationPlayer" parent="Animations"]
libraries = {
"": SubResource("AnimationLibrary_kks2p")
}
[node name="Effects" type="Node2D" parent="."]
[node name="HurtParticles" type="GPUParticles2D" parent="Effects"]
position = Vector2(0, -8)
emitting = false
process_material = ExtResource("11_qcw5x")
texture = ExtResource("12_rlelw")
lifetime = 0.4
one_shot = true
explosiveness = 1.0
[node name="DeathParticles" type="GPUParticles2D" parent="Effects"]
emitting = false
amount = 32
process_material = ExtResource("13_kgmsk")
texture = SubResource("CanvasTexture_pited")
lifetime = 2.0
one_shot = true
preprocess = 0.1
explosiveness = 0.9
[node name="SpawnParticles" type="GPUParticles2D" parent="Effects"]
emitting = false
amount = 24
process_material = SubResource("ParticleProcessMaterial_qdhau")
texture = ExtResource("14_88n3w")
[node name="HurtSound" type="AudioStreamPlayer2D" parent="Effects"]
stream = ExtResource("15_w7mkq")
[node name="Sprites" type="Node2D" parent="."]
y_sort_enabled = true
use_parent_material = true
position = Vector2(-0.5, 0)
rotation = 6.28319
[node name="Node2D" type="Node2D" parent="Sprites"]
use_parent_material = true
[node name="Character" type="Sprite2D" parent="Sprites/Node2D"]
use_parent_material = true
texture = ExtResource("16_vtfwo")
offset = Vector2(0, -12)
hframes = 7
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, -4)
shape = SubResource("RectangleShape2D_bfqew")
[node name="Inventory" type="Node2D" parent="."]
position = Vector2(0, -4)
script = ExtResource("17_5rur0")
[node name="DocLance" parent="Inventory" instance=ExtResource("18_jblpi")]
position = Vector2(0, 4)
[node name="Hurtbox" parent="." instance=ExtResource("20_dwjfv")]
[node name="CollisionShape2D" parent="Hurtbox" index="0"]
position = Vector2(0, -8)
shape = SubResource("RectangleShape2D_1gjgc")
[editable path="Hurtbox"]

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=61 format=3 uid="uid://b2254pup8k161"] [gd_scene load_steps=63 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"]
@ -28,6 +28,8 @@
[ext_resource type="Texture2D" uid="uid://d1ukste16yq6v" path="res://Assets/Sprites/Particles/player-light.png" id="15_3hahh"] [ext_resource type="Texture2D" uid="uid://d1ukste16yq6v" path="res://Assets/Sprites/Particles/player-light.png" id="15_3hahh"]
[ext_resource type="Script" path="res://Utils/DamageTime.cs" id="15_4xl06"] [ext_resource type="Script" path="res://Utils/DamageTime.cs" id="15_4xl06"]
[ext_resource type="PackedScene" uid="uid://g7wfcubs6bdd" path="res://Items/Weapons/Railgun.tscn" id="21_n8w32"] [ext_resource type="PackedScene" uid="uid://g7wfcubs6bdd" path="res://Items/Weapons/Railgun.tscn" id="21_n8w32"]
[ext_resource type="PackedScene" uid="uid://5y1acxl4j4n7" path="res://Items/Weapons/Pugio.tscn" id="22_mqpn7"]
[ext_resource type="PackedScene" uid="uid://d1d4vg7we5rjr" path="res://Items/Weapons/Shotgun.tscn" id="22_rmciq"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_h78y7"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_h78y7"]
shader = ExtResource("2_ngsgt") shader = ExtResource("2_ngsgt")
@ -479,6 +481,7 @@ label_settings = SubResource("LabelSettings_q5h1n")
horizontal_alignment = 1 horizontal_alignment = 1
[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 = {
@ -486,15 +489,12 @@ InventoryMap = {
"equip_2": 1 "equip_2": 1
} }
[node name="Sword" parent="Inventory" instance=ExtResource("22_mqpn7")]
[node name="Shotgun" parent="Inventory" instance=ExtResource("22_rmciq")]
[node name="Node2D" parent="Inventory" instance=ExtResource("7_4rxuv")] [node name="Node2D" parent="Inventory" instance=ExtResource("7_4rxuv")]
visible = false visible = false
InitialVelocity = 0.0
ShouldFreezeAngleOnUse = true
MinDistanceHint = 0.0
MaxDistanceHint = 0.0
ItemName = ""
Description = ""
CanStack = false
[node name="Railgun" parent="Inventory" instance=ExtResource("21_n8w32")] [node name="Railgun" parent="Inventory" instance=ExtResource("21_n8w32")]
UseTime = 0.2 UseTime = 0.2

View File

@ -393,21 +393,17 @@ material = SubResource("ShaderMaterial_2fq6c")
collision_layer = 6 collision_layer = 6
collision_mask = 17 collision_mask = 17
script = ExtResource("2_l16dp") script = ExtResource("2_l16dp")
PreferredWeightDistance = null
MaxWeightDistance = null
DefaultSelectedItem = NodePath("Inventory/ProjectileSpawner") DefaultSelectedItem = NodePath("Inventory/ProjectileSpawner")
ShouldMoveWhenUsingItem = false ShouldMoveWhenUsingItem = false
ThinkerStateMachine = NodePath("ThinkerStateMachine") ThinkerStateMachine = NodePath("ThinkerStateMachine")
Speed = 40.0 Speed = 40.0
Friction = 8.0 Friction = 8.0
Mass = 0.5 Mass = 0.5
Stealth = null
Health = 170.0 Health = 170.0
Sprite = NodePath("Sprites/Node2D/Character") Sprite = NodePath("Sprites/Node2D/Character")
Inventory = NodePath("Inventory") Inventory = NodePath("Inventory")
StateMachine = NodePath("StateMachine") StateMachine = NodePath("StateMachine")
Hurtbox = NodePath("Hurtbox") Hurtbox = NodePath("Hurtbox")
Faction = null
[node name="StateMachine" type="Node" parent="." node_paths=PackedStringArray("InitialState", "Character")] [node name="StateMachine" type="Node" parent="." node_paths=PackedStringArray("InitialState", "Character")]
script = ExtResource("3_lj2a2") script = ExtResource("3_lj2a2")
@ -433,25 +429,19 @@ script = ExtResource("7_q01ij")
NavigationAgent = NodePath("../../NavigationAgent2D") NavigationAgent = NodePath("../../NavigationAgent2D")
AttackState = NodePath("../Attack") AttackState = NodePath("../Attack")
MinDistanceToTarget = 96.0 MinDistanceToTarget = 96.0
MaxDistanceFromOrigin = null
LastSeenPosition = null
ThinkDelta = 0.05 ThinkDelta = 0.05
NPC = NodePath("../..") NPC = NodePath("../..")
[node name="Attack" type="Node" parent="ThinkerStateMachine" node_paths=PackedStringArray("PassiveState", "PursueState", "NPC")] [node name="Attack" type="Node" parent="ThinkerStateMachine" node_paths=PackedStringArray("PassiveState", "PursueState", "NPC")]
script = ExtResource("8_woh6n") script = ExtResource("8_woh6n")
PreferredWeightDistance = null
MaxWeightDistance = null
MaxDistanceToTarget = 128.0 MaxDistanceToTarget = 128.0
PassiveState = NodePath("../Pursue") PassiveState = NodePath("../Pursue")
PursueState = NodePath("../Pursue") PursueState = NodePath("../Pursue")
ThinkDelta = null
NPC = NodePath("../..") NPC = NodePath("../..")
[node name="Idle" type="Node" parent="ThinkerStateMachine"] [node name="Idle" type="Node" parent="ThinkerStateMachine"]
[node name="NavigationAgent2D" type="NavigationAgent2D" parent="."] [node name="NavigationAgent2D" type="NavigationAgent2D" parent="."]
path_postprocessing = 1
debug_enabled = true debug_enabled = true
[node name="Animations" type="Node" parent="."] [node name="Animations" type="Node" parent="."]
@ -527,31 +517,17 @@ hframes = 6
position = Vector2(0, -4) position = Vector2(0, -4)
shape = SubResource("RectangleShape2D_bfqew") shape = SubResource("RectangleShape2D_bfqew")
[node name="Inventory" type="Node2D" parent="." node_paths=PackedStringArray("Items")] [node name="Inventory" type="Node2D" parent="."]
position = Vector2(0, -4) position = Vector2(0, -4)
script = ExtResource("17_sjq8t") script = ExtResource("17_sjq8t")
Items = []
[node name="ProjectileSpawner" parent="Inventory" instance=ExtResource("17_dmlbb")] [node name="ProjectileSpawner" parent="Inventory" instance=ExtResource("17_dmlbb")]
Projectile = ExtResource("18_lwg36") Projectile = ExtResource("18_lwg36")
ShouldOverrideProjectileDamage = false ShouldOverrideProjectileDamage = false
ShouldRotate = false ShouldRotate = false
AngleDeviation = null
ChargeTime = null
Damage = null
UseTime = 2.0 UseTime = 2.0
Knockback = null
InitialVelocity = null
ShouldHideIdle = null
ShouldFreezeAngleOnUse = null
MinDistanceHint = null
MaxDistanceHint = null
ItemName = null
Description = null
CanStack = null
[node name="Hurtbox" parent="." instance=ExtResource("18_ajs2x")] [node name="Hurtbox" parent="." instance=ExtResource("18_ajs2x")]
Faction = null
[node name="CollisionShape2D" parent="Hurtbox" index="0"] [node name="CollisionShape2D" parent="Hurtbox" index="0"]
position = Vector2(0, -8) position = Vector2(0, -8)

View File

@ -0,0 +1,5 @@
namespace SupaLidlGame.Entities;
public partial class Bullet : Projectile
{
}

View File

@ -1,5 +1,7 @@
using Godot; using Godot;
namespace SupaLidlGame.Extensions;
public static class AnimationPlayerExtensions public static class AnimationPlayerExtensions
{ {
public static bool TryPlay(this AnimationPlayer player, string name) public static bool TryPlay(this AnimationPlayer player, string name)

View File

@ -49,4 +49,14 @@ public abstract partial class Item : Node2D
public abstract void Use(); public abstract void Use();
public abstract void Deuse(); public abstract void Deuse();
public virtual void UseAlt()
{
}
public virtual void DeuseAlt()
{
}
} }

View File

@ -8,7 +8,11 @@ public abstract partial class Weapon : Item
{ {
public double RemainingUseTime { get; protected set; } = 0; public double RemainingUseTime { get; protected set; } = 0;
public override bool IsUsing => RemainingUseTime > 0; public override bool IsUsing => IsUsingPrimary || IsUsingAlt;
public virtual bool IsUsingPrimary => false;
public virtual bool IsUsingAlt => false;
/// <summary> /// <summary>
/// How much damage in HP that this weapon deals. /// How much damage in HP that this weapon deals.
@ -23,6 +27,9 @@ public abstract partial class Weapon : Item
[Export] [Export]
public double UseTime { get; set; } = 0; public double UseTime { get; set; } = 0;
[Export]
public double UseAltTime { get; set; } = 0;
/// <summary> /// <summary>
/// The magnitude of the knockback force of the weapon. /// The magnitude of the knockback force of the weapon.
/// </summary> /// </summary>

View File

@ -207,9 +207,9 @@ Description = "\"Violence. Speed. Momentum.\""
script = ExtResource("2_c41ov") script = ExtResource("2_c41ov")
InitialState = NodePath("Idle") InitialState = NodePath("Idle")
[node name="Idle" type="Node" parent="State" node_paths=PackedStringArray("AnticipateState", "Sword")] [node name="Idle" type="Node" parent="State" node_paths=PackedStringArray("UseState", "Sword")]
script = ExtResource("3_sxffm") script = ExtResource("3_sxffm")
AnticipateState = NodePath("../Anticipate") UseState = NodePath("../Anticipate")
Sword = NodePath("../..") Sword = NodePath("../..")
[node name="Anticipate" type="Node" parent="State" node_paths=PackedStringArray("Sword", "AttackState")] [node name="Anticipate" type="Node" parent="State" node_paths=PackedStringArray("Sword", "AttackState")]

View File

@ -10,6 +10,9 @@ public partial class ProjectileSpawner : Ranged
[Export] [Export]
public bool ShouldOverrideProjectileDamage { get; set; } = true; public bool ShouldOverrideProjectileDamage { get; set; } = true;
[Export]
public bool ShouldOverrideVelocity { get; set; } = true;
[Export] [Export]
public bool ShouldRotate { get; set; } = true; public bool ShouldRotate { get; set; } = true;
@ -20,6 +23,7 @@ public partial class ProjectileSpawner : Ranged
projectile.Hitbox.Faction = Character.Faction; projectile.Hitbox.Faction = Character.Faction;
projectile.Direction = Character.Target.Normalized(); projectile.Direction = Character.Target.Normalized();
projectile.GlobalPosition = GlobalPosition; projectile.GlobalPosition = GlobalPosition;
projectile.Speed = InitialVelocity;
if (ShouldRotate) if (ShouldRotate)
{ {

View File

@ -0,0 +1,463 @@
[gd_scene load_steps=26 format=3 uid="uid://5y1acxl4j4n7"]
[ext_resource type="Script" path="res://Items/Weapons/Sword.cs" id="1_mai31"]
[ext_resource type="Script" path="res://State/Weapon/WeaponStateMachine.cs" id="2_5ramr"]
[ext_resource type="Script" path="res://State/Weapon/SwordIdleState.cs" id="3_fwkit"]
[ext_resource type="Script" path="res://State/Weapon/SwordAnticipateState.cs" id="4_nsn1q"]
[ext_resource type="Script" path="res://State/Weapon/SwordAttackState.cs" id="5_g1en5"]
[ext_resource type="Texture2D" uid="uid://dfpe74vxvuwal" path="res://Assets/Sprites/Items/pugio.png" id="6_d28k5"]
[ext_resource type="Script" path="res://State/Weapon/SwordBlockState.cs" id="6_yvm8x"]
[ext_resource type="Material" uid="uid://cbfaqolx1ydvv" path="res://Assets/Sprites/Particles/ParryParticles.tres" id="8_we1sv"]
[ext_resource type="PackedScene" uid="uid://du5vhccg75nrq" path="res://BoundingBoxes/Hitbox.tscn" id="9_qimey"]
[ext_resource type="Texture2D" uid="uid://ct0m4lk2icx3p" path="res://Assets/Sprites/sword-swing-small.png" id="10_q8b54"]
[ext_resource type="Shader" path="res://Shaders/Flash.gdshader" id="11_b1fwx"]
[ext_resource type="Texture2D" uid="uid://417j1ckcjg2i" path="res://Assets/Sprites/Items/doc-shield.png" id="11_qpejo"]
[ext_resource type="AudioStream" uid="uid://qvthq6tppp63" path="res://Assets/Sounds/whoosh.wav" id="12_a8o3x"]
[ext_resource type="AudioStream" uid="uid://c4n7ioxpukdwi" path="res://Assets/Sounds/parry.wav" id="13_t5wmj"]
[sub_resource type="Environment" id="Environment_72txp"]
background_mode = 3
glow_enabled = true
glow_hdr_threshold = 1.42
[sub_resource type="Animation" id="Animation_b7327"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Anchor:rotation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [3.14159]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("SwingSprite:frame")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [0]
}
tracks/2/type = "method"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath(".")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"values": [{
"args": ["is_alternate", false],
"method": &"SetAnimationCondition"
}]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("SwingSprite:modulate")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(2, 2, 2, 1)]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("Anchor/Node2D/Sprite2D:visible")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("Shield:scale")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(1, 1)]
}
tracks/6/type = "value"
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/path = NodePath("Shield:material:shader_parameter/intensity")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.0]
}
[sub_resource type="Animation" id="Animation_ameas"]
resource_name = "anticipate"
length = 0.1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Anchor:rotation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(0.933033),
"update": 1,
"values": [3.14159]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Anchor/Node2D/Sprite2D:visible")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
[sub_resource type="Animation" id="Animation_bj2ky"]
resource_name = "anticipate_alternate"
length = 0.1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Anchor:rotation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [2.35619]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Anchor/Node2D:rotation")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [3.14159]
}
[sub_resource type="Animation" id="Animation_b8r8j"]
resource_name = "anticipate_bot"
[sub_resource type="Animation" id="Animation_6jphj"]
resource_name = "attack"
length = 0.5
step = 0.05
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Anchor:rotation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.35),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [0.0, 1.5708]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("SwingSprite:frame")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.2, 0.25),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [1, 2, 0]
}
tracks/2/type = "method"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath(".")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(),
"transitions": PackedFloat32Array(),
"values": []
}
tracks/3/type = "method"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("SwingSound")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0.1),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [0.0],
"method": &"play"
}]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("Anchor/Node2D/Sprite2D:visible")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0, 0.35),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [true, false]
}
[sub_resource type="Animation" id="Animation_pclfs"]
resource_name = "attack_alternate"
step = 0.05
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Anchor:rotation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.15, 0.35),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [1.5708, -1.5708, -1.5708]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("SwingSprite:frame")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0.1, 0.3, 0.35),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [3, 4, 0]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = false
tracks/2/path = NodePath("Anchor:position")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0, 0.1, 0.35),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [Vector2(0, 0), Vector2(0, -4), Vector2(0, 0)]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("Anchor/Node2D:rotation")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0, 0.15),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [3.14159, 0.785398]
}
tracks/4/type = "method"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath(".")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0.2),
"transitions": PackedFloat32Array(1),
"values": [{
"args": ["is_alternate", false],
"method": &"SetAnimationCondition"
}]
}
[sub_resource type="Animation" id="Animation_x1aou"]
resource_name = "block"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Shield:scale")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.5, 1),
"transitions": PackedFloat32Array(1, 0.25, 1),
"update": 0,
"values": [Vector2(1.4, 1.4), Vector2(1.4, 1.4), Vector2(1, 1)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Shield:material:shader_parameter/intensity")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.5, 1),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 0,
"values": [1.0, 1.0, 0.0]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_11u25"]
_data = {
"RESET": SubResource("Animation_b7327"),
"anticipate": SubResource("Animation_ameas"),
"anticipate_alternate": SubResource("Animation_bj2ky"),
"anticipate_bot": SubResource("Animation_b8r8j"),
"attack": SubResource("Animation_6jphj"),
"attack_alternate": SubResource("Animation_pclfs"),
"block": SubResource("Animation_x1aou")
}
[sub_resource type="ConvexPolygonShape2D" id="ConvexPolygonShape2D_ycxcw"]
points = PackedVector2Array(0, 0, -30, 0, -21.213, -21.213, 0, -30, 21.213, -21.213, 30, 0, 0, 0)
[sub_resource type="ShaderMaterial" id="ShaderMaterial_rgypv"]
resource_local_to_scene = true
shader = ExtResource("11_b1fwx")
shader_parameter/color = Quaternion(1, 1, 1, 1)
shader_parameter/intensity = 0.0
shader_parameter/alpha_modulate = 1.0
[node name="Pugio" type="Node2D" node_paths=PackedStringArray("Hitbox", "AnimationPlayer", "ParryParticles", "StateMachine", "Anchor", "HandAnchor")]
y_sort_enabled = true
texture_filter = 3
script = ExtResource("1_mai31")
Hitbox = NodePath("Hitbox")
AnimationPlayer = NodePath("AnimationPlayer")
AttackTime = 0.2
AttackAltTime = 0.75
AttackAnimationDuration = 0.5
ParryParticles = NodePath("Anchor/Node2D/Sprite2D/ParryParticles")
NPCAnticipateTime = 0.3
StateMachine = NodePath("State")
Anchor = NodePath("Anchor")
Damage = 20.0
UseTime = 0.55
UseAltTime = 1.5
Knockback = 64.0
HandAnchor = NodePath("Anchor/Node2D/Sprite2D/Hand")
[node name="State" type="Node" parent="." node_paths=PackedStringArray("InitialState")]
script = ExtResource("2_5ramr")
InitialState = NodePath("Idle")
[node name="Idle" type="Node" parent="State" node_paths=PackedStringArray("UseState", "UseAltState", "Sword")]
script = ExtResource("3_fwkit")
UseState = NodePath("../Anticipate")
UseAltState = NodePath("../Block")
Sword = NodePath("../..")
[node name="Anticipate" type="Node" parent="State" node_paths=PackedStringArray("Sword", "AttackState")]
script = ExtResource("4_nsn1q")
Sword = NodePath("../..")
AttackState = NodePath("../Attack")
[node name="Attack" type="Node" parent="State" node_paths=PackedStringArray("Sword", "IdleState")]
script = ExtResource("5_g1en5")
Sword = NodePath("../..")
IdleState = NodePath("../Idle")
[node name="Block" type="Node" parent="State" node_paths=PackedStringArray("Sword", "IdleState", "UseState")]
script = ExtResource("6_yvm8x")
Sword = NodePath("../..")
IdleState = NodePath("../Idle")
UseState = NodePath("../Anticipate")
BlockAnimKey = "block"
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_72txp")
[node name="Anchor" type="Node2D" parent="."]
y_sort_enabled = true
rotation = 3.14159
[node name="Node2D" type="Node2D" parent="Anchor"]
y_sort_enabled = true
position = Vector2(0, -20)
[node name="Sprite2D" type="Sprite2D" parent="Anchor/Node2D"]
visible = false
y_sort_enabled = true
texture = ExtResource("6_d28k5")
[node name="ParryParticles" type="GPUParticles2D" parent="Anchor/Node2D/Sprite2D"]
modulate = Color(1.2, 1.2, 1.2, 1)
position = Vector2(-0.221825, -3.12132)
rotation = 0.785398
emitting = false
amount = 16
process_material = ExtResource("8_we1sv")
lifetime = 2.0
one_shot = true
explosiveness = 1.0
trail_enabled = true
trail_lifetime = 0.1
trail_sections = 4
[node name="Hand" type="Sprite2D" parent="Anchor/Node2D/Sprite2D"]
position = Vector2(-2.52724e-05, 7)
rotation = 1.5708
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_11u25")
}
[node name="Hitbox" parent="." instance=ExtResource("9_qimey")]
IsDisabled = true
[node name="CollisionShape2D" parent="Hitbox" index="0"]
rotation = 1.5708
shape = SubResource("ConvexPolygonShape2D_ycxcw")
disabled = true
[node name="SwingSprite" type="Sprite2D" parent="."]
modulate = Color(2, 2, 2, 1)
texture = ExtResource("10_q8b54")
hframes = 3
[node name="Shield" type="Sprite2D" parent="."]
y_sort_enabled = true
material = SubResource("ShaderMaterial_rgypv")
position = Vector2(7, 8)
texture = ExtResource("11_qpejo")
offset = Vector2(0, -12)
[node name="SwingSound" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("12_a8o3x")
pitch_scale = 1.2
[node name="ParrySound" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("13_t5wmj")
[editable path="Hitbox"]

View File

@ -13,7 +13,7 @@ public abstract partial class Ranged : Weapon
[Export] [Export]
public State.Weapon.WeaponStateMachine StateMachine { get; set; } public State.Weapon.WeaponStateMachine StateMachine { get; set; }
public override bool IsUsing => StateMachine.CurrentState public override bool IsUsingPrimary => StateMachine.CurrentState
is State.Weapon.RangedFireState; is State.Weapon.RangedFireState;
public bool IsChargeable => ChargeTime > 0; public bool IsChargeable => ChargeTime > 0;

View File

@ -0,0 +1,216 @@
[gd_scene load_steps=18 format=3 uid="uid://d1d4vg7we5rjr"]
[ext_resource type="Script" path="res://Items/Weapons/ProjectileSpawner.cs" id="1_4xyyt"]
[ext_resource type="Script" path="res://State/Weapon/WeaponStateMachine.cs" id="2_ag6rd"]
[ext_resource type="PackedScene" uid="uid://bqvseo3sbs1aj" path="res://Entities/RailBeam.tscn" id="2_k2n4h"]
[ext_resource type="Script" path="res://State/Weapon/RangedIdleState.cs" id="3_dd6bh"]
[ext_resource type="Script" path="res://State/Weapon/RangedFireState.cs" id="4_bwqd6"]
[ext_resource type="Texture2D" uid="uid://b1omx2kdb2x1n" path="res://Assets/Sprites/Items/shotgun.png" id="5_g8d45"]
[ext_resource type="Texture2D" uid="uid://c1a7lvb4uuwfy" path="res://Assets/Sprites/Particles/circle-16.png" id="6_va8ee"]
[ext_resource type="AudioStream" uid="uid://5fybh24xashp" path="res://Assets/Sounds/shotgun.wav" id="7_ucxp5"]
[sub_resource type="Animation" id="Animation_i0e06"]
resource_name = "fire"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.2),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [Vector2(-4, 0), Vector2(0, 0)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("GPUParticles2D:emitting")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.2),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [true, false]
}
tracks/2/type = "audio"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("AudioStreamPlayer2D")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"clips": [{
"end_offset": 0.0,
"start_offset": 0.0,
"stream": ExtResource("7_ucxp5")
}],
"times": PackedFloat32Array(0)
}
tracks/2/use_blend = true
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("Sprite2D:rotation")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0.5, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [0.0, 6.28319]
}
[sub_resource type="Animation" id="Animation_sqn2o"]
resource_name = "idle"
length = 0.1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, 0)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Sprite2D:rotation")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.0]
}
[sub_resource type="Animation" id="Animation_vijrc"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, 0)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("GPUParticles2D:emitting")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("Sprite2D:rotation")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.0]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_si0kh"]
_data = {
"RESET": SubResource("Animation_vijrc"),
"fire": SubResource("Animation_i0e06"),
"idle": SubResource("Animation_sqn2o")
}
[sub_resource type="Gradient" id="Gradient_uphon"]
colors = PackedColorArray(1, 1, 1, 0.498039, 1, 1, 1, 0)
[sub_resource type="GradientTexture1D" id="GradientTexture1D_83h4s"]
gradient = SubResource("Gradient_uphon")
[sub_resource type="Curve" id="Curve_mqgo6"]
_data = [Vector2(0.5, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
point_count = 2
[sub_resource type="CurveTexture" id="CurveTexture_3omj5"]
curve = SubResource("Curve_mqgo6")
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_uexo4"]
particle_flag_disable_z = true
direction = Vector3(0, -1, 0)
spread = 90.0
gravity = Vector3(0, -4, 0)
initial_velocity_min = 3.0
initial_velocity_max = 4.0
orbit_velocity_min = 0.0
orbit_velocity_max = 0.0
scale_min = 0.1
scale_max = 0.1
scale_curve = SubResource("CurveTexture_3omj5")
color_ramp = SubResource("GradientTexture1D_83h4s")
[node name="Shotgun" type="Node2D" node_paths=PackedStringArray("StateMachine")]
script = ExtResource("1_4xyyt")
Projectile = ExtResource("2_k2n4h")
StateMachine = NodePath("State")
Damage = 20.0
UseTime = 1.0
InitialVelocity = 256.0
[node name="State" type="Node" parent="." node_paths=PackedStringArray("InitialState")]
script = ExtResource("2_ag6rd")
InitialState = NodePath("Idle")
[node name="Idle" type="Node" parent="State" node_paths=PackedStringArray("FireState", "Weapon", "AnimationPlayer")]
script = ExtResource("3_dd6bh")
FireState = NodePath("../Fire")
Weapon = NodePath("../..")
AnimationPlayer = NodePath("../../AnimationPlayer")
AnimationKey = "idle"
[node name="Fire" type="Node" parent="State" node_paths=PackedStringArray("Weapon", "IdleState", "AnimationPlayer")]
script = ExtResource("4_bwqd6")
Weapon = NodePath("../..")
IdleState = NodePath("../Idle")
AnimationPlayer = NodePath("../../AnimationPlayer")
AnimationKey = "fire"
[node name="Sprite2D" type="Sprite2D" parent="."]
texture_filter = 1
texture = ExtResource("5_g8d45")
centered = false
offset = Vector2(0, -2)
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_si0kh")
}
[node name="GPUParticles2D" type="GPUParticles2D" parent="."]
position = Vector2(16, -1)
emitting = false
amount = 4
process_material = SubResource("ParticleProcessMaterial_uexo4")
texture = ExtResource("6_va8ee")
lifetime = 0.5
one_shot = true
explosiveness = 1.0
[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."]
max_distance = 256.0
bus = &"Effects"

View File

@ -11,8 +11,13 @@ public partial class Sword : Weapon, IParryable
{ {
public bool IsAttacking { get; protected set; } public bool IsAttacking { get; protected set; }
public override bool IsUsing => StateMachine.CurrentState public override bool IsUsing => IsUsingPrimary || IsUsingAlt;
is SwordAttackState;
public override bool IsUsingPrimary => StateMachine.CurrentState is
SwordAttackState;
public override bool IsUsingAlt => StateMachine.CurrentState is
SwordBlockState;
[Export] [Export]
public Hitbox Hitbox { get; set; } public Hitbox Hitbox { get; set; }
@ -30,6 +35,9 @@ public partial class Sword : Weapon, IParryable
[Export] [Export]
public double AttackTime { get; set; } = 0; public double AttackTime { get; set; } = 0;
[Export]
public double AttackAltTime { get; set; } = 0;
[Export] [Export]
public double AttackAnimationDuration { get; set; } public double AttackAnimationDuration { get; set; }
@ -64,17 +72,16 @@ public partial class Sword : Weapon, IParryable
base.Unequip(character); base.Unequip(character);
} }
public override void Use() public void EnableParry()
{ {
StateMachine.Use(); EnableParry(Time.GetTicksMsec());
base.Use();
} }
public void EnableParry() public void EnableParry(ulong parryTimeOrigin)
{ {
IsParried = false; IsParried = false;
IsParryable = true; IsParryable = true;
ParryTimeOrigin = Time.GetTicksMsec(); ParryTimeOrigin = parryTimeOrigin;
} }
public void DisableParry() public void DisableParry()
@ -82,14 +89,30 @@ public partial class Sword : Weapon, IParryable
IsParryable = false; IsParryable = false;
} }
public override void Use()
{
StateMachine.Use();
base.Use();
}
public override void Deuse() public override void Deuse()
{ {
//AnimationPlayer.Stop();
//Deattack();
StateMachine.Deuse(); StateMachine.Deuse();
base.Deuse(); base.Deuse();
} }
public override void UseAlt()
{
StateMachine.UseAlt();
base.UseAlt();
}
public override void DeuseAlt()
{
StateMachine.DeuseAlt();
base.DeuseAlt();
}
public void Attack() public void Attack()
{ {
//RemainingAttackTime = AttackTime; //RemainingAttackTime = AttackTime;
@ -130,7 +153,6 @@ public partial class Sword : Weapon, IParryable
{ {
if (box is Hurtbox hurtbox) if (box is Hurtbox hurtbox)
{ {
GD.Print("LUL");
hurtbox.InflictDamage(Damage, Character, Knockback); hurtbox.InflictDamage(Damage, Character, Knockback);
} }
} }
@ -145,10 +167,15 @@ public partial class Sword : Weapon, IParryable
{ {
// our character was parried // our character was parried
ParryParticles.CloneOnWorld<GpuParticles2D>().EmitOneShot(); ParryParticles.CloneOnWorld<GpuParticles2D>().EmitOneShot();
} Stun();
else
{ if (otherParryable is Sword sword)
otherParryable.Stun(); {
if (sword.StateMachine.CurrentState is SwordBlockState b)
{
b.HasBlocked = true;
}
}
} }
} }
} }

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=35 format=3 uid="uid://dvqap2uhcah63"] [gd_scene load_steps=36 format=3 uid="uid://dvqap2uhcah63"]
[ext_resource type="Script" path="res://Items/Weapons/Sword.cs" id="1_mlo73"] [ext_resource type="Script" path="res://Items/Weapons/Sword.cs" id="1_mlo73"]
[ext_resource type="Script" path="res://State/Weapon/WeaponStateMachine.cs" id="2_vwirq"] [ext_resource type="Script" path="res://State/Weapon/WeaponStateMachine.cs" id="2_vwirq"]
@ -351,6 +351,8 @@ states/use/position = Vector2(609, 75)
transitions = ["Start", "anticipate", SubResource("AnimationNodeStateMachineTransition_esyoj"), "use", "RESET", SubResource("AnimationNodeStateMachineTransition_kg3rd"), "RESET", "anticipate", SubResource("AnimationNodeStateMachineTransition_twtoe"), "anticipate", "anticipate_bot", SubResource("AnimationNodeStateMachineTransition_73wvy"), "anticipate_bot", "use", SubResource("AnimationNodeStateMachineTransition_4wst0"), "anticipate", "use", SubResource("AnimationNodeStateMachineTransition_2lfol")] transitions = ["Start", "anticipate", SubResource("AnimationNodeStateMachineTransition_esyoj"), "use", "RESET", SubResource("AnimationNodeStateMachineTransition_kg3rd"), "RESET", "anticipate", SubResource("AnimationNodeStateMachineTransition_twtoe"), "anticipate", "anticipate_bot", SubResource("AnimationNodeStateMachineTransition_73wvy"), "anticipate_bot", "use", SubResource("AnimationNodeStateMachineTransition_4wst0"), "anticipate", "use", SubResource("AnimationNodeStateMachineTransition_2lfol")]
graph_offset = Vector2(0, -104.073) graph_offset = Vector2(0, -104.073)
[sub_resource type="AnimationNodeStateMachinePlayback" id="AnimationNodeStateMachinePlayback_37556"]
[node name="Sword" type="Node2D" node_paths=PackedStringArray("Hitbox", "AnimationPlayer", "ParryParticles", "StateMachine", "Anchor", "HandAnchor")] [node name="Sword" type="Node2D" node_paths=PackedStringArray("Hitbox", "AnimationPlayer", "ParryParticles", "StateMachine", "Anchor", "HandAnchor")]
y_sort_enabled = true y_sort_enabled = true
texture_filter = 3 texture_filter = 3
@ -366,36 +368,27 @@ Anchor = NodePath("Anchor")
Damage = 20.0 Damage = 20.0
UseTime = 0.55 UseTime = 0.55
Knockback = 64.0 Knockback = 64.0
InitialVelocity = null
ShouldHideIdle = true ShouldHideIdle = true
ShouldFreezeAngleOnUse = null
MinDistanceHint = null
MaxDistanceHint = null
HandAnchor = NodePath("Anchor/Node2D/Sprite2D/Hand") HandAnchor = NodePath("Anchor/Node2D/Sprite2D/Hand")
ItemName = null
Description = null
CanStack = null
[node name="State" type="Node" parent="." node_paths=PackedStringArray("InitialState")] [node name="State" type="Node" parent="." node_paths=PackedStringArray("InitialState")]
script = ExtResource("2_vwirq") script = ExtResource("2_vwirq")
InitialState = NodePath("Idle") InitialState = NodePath("Idle")
[node name="Idle" type="Node" parent="State" node_paths=PackedStringArray("AnticipateState", "Sword")] [node name="Idle" type="Node" parent="State" node_paths=PackedStringArray("UseState", "Sword")]
script = ExtResource("3_nw6r0") script = ExtResource("3_nw6r0")
AnticipateState = NodePath("../Anticipate") UseState = NodePath("../Anticipate")
Sword = NodePath("../..") Sword = NodePath("../..")
[node name="Anticipate" type="Node" parent="State" node_paths=PackedStringArray("Sword", "AttackState")] [node name="Anticipate" type="Node" parent="State" node_paths=PackedStringArray("Sword", "AttackState")]
script = ExtResource("4_j3cud") script = ExtResource("4_j3cud")
Sword = NodePath("../..") Sword = NodePath("../..")
AttackState = NodePath("../Attack") AttackState = NodePath("../Attack")
HasAlternateAninmation = null
[node name="Attack" type="Node" parent="State" node_paths=PackedStringArray("Sword", "IdleState")] [node name="Attack" type="Node" parent="State" node_paths=PackedStringArray("Sword", "IdleState")]
script = ExtResource("5_hmisb") script = ExtResource("5_hmisb")
Sword = NodePath("../..") Sword = NodePath("../..")
IdleState = NodePath("../Idle") IdleState = NodePath("../Idle")
HasAlternateAnimation = null
[node name="WorldEnvironment" type="WorldEnvironment" parent="."] [node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_72txp") environment = SubResource("Environment_72txp")
@ -409,7 +402,6 @@ position = Vector2(2.40734, -0.55655)
rotation = 0.945464 rotation = 0.945464
width_curve = SubResource("Curve_4cxtp") width_curve = SubResource("Curve_4cxtp")
gradient = SubResource("Gradient_2ablm") gradient = SubResource("Gradient_2ablm")
Frequency = null
[node name="Node2D" type="Node2D" parent="Anchor"] [node name="Node2D" type="Node2D" parent="Anchor"]
y_sort_enabled = true y_sort_enabled = true
@ -447,14 +439,11 @@ libraries = {
tree_root = SubResource("AnimationNodeStateMachine_q4hbp") tree_root = SubResource("AnimationNodeStateMachine_q4hbp")
anim_player = NodePath("../AnimationPlayer") anim_player = NodePath("../AnimationPlayer")
active = true active = true
parameters/playback = SubResource("AnimationNodeStateMachinePlayback_37556")
parameters/conditions/is_player = false parameters/conditions/is_player = false
[node name="Hitbox" parent="." instance=ExtResource("3_up3ob")] [node name="Hitbox" parent="." instance=ExtResource("3_up3ob")]
priority = 5
Damage = null
IsDisabled = true IsDisabled = true
Knockback = null
Faction = null
[node name="CollisionShape2D" parent="Hitbox" index="0"] [node name="CollisionShape2D" parent="Hitbox" index="0"]
position = Vector2(4, 0) position = Vector2(4, 0)

View File

@ -11,7 +11,7 @@
[ext_resource type="PackedScene" uid="uid://dldnp8eunxj3q" path="res://BoundingBoxes/InteractionTrigger.tscn" id="9_3401j"] [ext_resource type="PackedScene" uid="uid://dldnp8eunxj3q" path="res://BoundingBoxes/InteractionTrigger.tscn" id="9_3401j"]
[ext_resource type="Script" path="res://BoundingBoxes/ConnectorBox.cs" id="9_fg062"] [ext_resource type="Script" path="res://BoundingBoxes/ConnectorBox.cs" id="9_fg062"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_4fu3e"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_tr5pw"]
resource_local_to_scene = true resource_local_to_scene = true
shader = ExtResource("5_h8k5p") shader = ExtResource("5_h8k5p")
shader_parameter/color = Vector4(1, 1, 1, 1) shader_parameter/color = Vector4(1, 1, 1, 1)
@ -113,7 +113,7 @@ visible = false
position = Vector2(120, -112) position = Vector2(120, -112)
[node name="Doc" parent="Entities" index="0" instance=ExtResource("4_ej0f3")] [node name="Doc" parent="Entities" index="0" instance=ExtResource("4_ej0f3")]
material = SubResource("ShaderMaterial_4fu3e") material = SubResource("ShaderMaterial_tr5pw")
[node name="PointLight2D" type="PointLight2D" parent="Entities" index="1"] [node name="PointLight2D" type="PointLight2D" parent="Entities" index="1"]
position = Vector2(168, -42) position = Vector2(168, -42)

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=46 format=3 uid="uid://c72uqjjtxpi3g"] [gd_scene load_steps=53 format=3 uid="uid://dr3bcvql7burk"]
[ext_resource type="PackedScene" uid="uid://clwv2owvk6abe" path="res://Scenes/BaseMap.tscn" id="1_ci4ij"] [ext_resource type="PackedScene" uid="uid://clwv2owvk6abe" path="res://Scenes/BaseMap.tscn" id="1_ci4ij"]
[ext_resource type="TileSet" uid="uid://l61kbx31ug4p" path="res://Scenes/Maps/ArenaTileset.tres" id="2_m6h7j"] [ext_resource type="TileSet" uid="uid://l61kbx31ug4p" path="res://Scenes/Maps/ArenaTileset.tres" id="2_m6h7j"]
@ -26,6 +26,9 @@
[ext_resource type="PackedScene" uid="uid://c5i3cq1kewljv" path="res://Props/ArenaDoor.tscn" id="21_nvrif"] [ext_resource type="PackedScene" uid="uid://c5i3cq1kewljv" path="res://Props/ArenaDoor.tscn" id="21_nvrif"]
[ext_resource type="PackedScene" uid="uid://bs6xuujve2tsf" path="res://Props/ArenaDoorSwitch.tscn" id="22_ay852"] [ext_resource type="PackedScene" uid="uid://bs6xuujve2tsf" path="res://Props/ArenaDoorSwitch.tscn" id="22_ay852"]
[ext_resource type="PackedScene" uid="uid://dhl071rj5wyvx" path="res://Entities/Campfire.tscn" id="23_mykt8"] [ext_resource type="PackedScene" uid="uid://dhl071rj5wyvx" path="res://Entities/Campfire.tscn" id="23_mykt8"]
[ext_resource type="PackedScene" uid="uid://cdj50hb84aujp" path="res://Characters/DocLegionary.tscn" id="27_84gw4"]
[ext_resource type="Shader" path="res://Shaders/Flash.gdshader" id="28_b3suq"]
[ext_resource type="PackedScene" uid="uid://dhamcei7tfta8" path="res://Characters/DocCenturion.tscn" id="30_qfl2k"]
[sub_resource type="Gradient" id="Gradient_jupxw"] [sub_resource type="Gradient" id="Gradient_jupxw"]
offsets = PackedFloat32Array(0.00740741, 0.2, 1) offsets = PackedFloat32Array(0.00740741, 0.2, 1)
@ -158,6 +161,34 @@ size = Vector2(64, 97)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_5pcme"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_5pcme"]
size = Vector2(18, 6) size = Vector2(18, 6)
[sub_resource type="ShaderMaterial" id="ShaderMaterial_73smm"]
resource_local_to_scene = true
shader = ExtResource("28_b3suq")
shader_parameter/color = Vector4(1, 1, 1, 1)
shader_parameter/intensity = 0.0
shader_parameter/alpha_modulate = 1.0
[sub_resource type="ShaderMaterial" id="ShaderMaterial_o3w21"]
resource_local_to_scene = true
shader = ExtResource("28_b3suq")
shader_parameter/color = Vector4(1, 1, 1, 1)
shader_parameter/intensity = 0.0
shader_parameter/alpha_modulate = 1.0
[sub_resource type="ShaderMaterial" id="ShaderMaterial_gp117"]
resource_local_to_scene = true
shader = ExtResource("28_b3suq")
shader_parameter/color = Vector4(1, 1, 1, 1)
shader_parameter/intensity = 0.0
shader_parameter/alpha_modulate = 1.0
[sub_resource type="ShaderMaterial" id="ShaderMaterial_7e6lj"]
resource_local_to_scene = true
shader = ExtResource("28_b3suq")
shader_parameter/color = Vector4(1, 1, 1, 1)
shader_parameter/intensity = 0.0
shader_parameter/alpha_modulate = 1.0
[node name="ArenaExterior" instance=ExtResource("1_ci4ij")] [node name="ArenaExterior" instance=ExtResource("1_ci4ij")]
tile_set = ExtResource("2_m6h7j") tile_set = ExtResource("2_m6h7j")
layer_0/tile_data = PackedInt32Array(-1703963, 393216, 0, -1703954, 393216, 0, -1703953, 458752, 2, -393224, 196608, 4, -262152, 196608, 4, -131080, 196608, 4, 196600, 196608, 4, 327672, 196608, 4, 458744, 196608, 4, -458759, 131072, 4, 589817, 458752, 4, -458757, 131072, 4, 589819, 458752, 4, -458755, 131072, 4, 589821, 458752, 4, -524286, 131072, 4, 524290, 458752, 4, -524284, 131072, 4, 524292, 458752, 4, -524282, 131072, 4, 524294, 458752, 4, -458744, 327680, 4, -327672, 327680, 4, -196600, 327680, 4, 131080, 327680, 4, 262152, 327680, 4, 393224, 327680, 4, -589819, 458752, 2, -524294, 458752, 2, -524292, 393216, 2, -589821, 393216, 2, 131070, 458752, 0, 131068, 458752, 0, 131066, 458752, 0, 262142, 458752, 0, 393214, 458752, 0, 327681, 458752, 0, 196609, 458752, 0, 65537, 458752, 0, 65539, 458752, 0, 65541, 458752, 0, -131067, 458752, 0, -131069, 458752, 0, -131071, 458752, 0, -262143, 458752, 0, -393215, 458752, 0, -327682, 458752, 0, -196610, 458752, 0, -65538, 458752, 0, -65540, 458752, 0, -65542, 458752, 0, -1638415, 131072, 4, -1638426, 131072, 4, -1507340, 131072, 4, -1572862, 131072, 4, -1507333, 131072, 4, -1703960, 393216, 2, 1900541, 131072, 4, 1835010, 131072, 4, 1835020, 131072, 4, 1835025, 131072, 4, 2883581, 458752, 4, 2818050, 458752, 4, 2818055, 458752, 4, 2818060, 458752, 4, 2818065, 458752, 4, 2097152, 458752, 0, 2097156, 458752, 0, 2097160, 458752, 0, 2097164, 458752, 0, 2490380, 458752, 0, 2490376, 458752, 0, 2490372, 458752, 0, 2490368, 458752, 0, 2097162, 458752, 0, 2097154, 458752, 0, 2490370, 458752, 0, 2490374, 458752, 0, 2097158, 458752, 0, 2490378, 458752, 0, 2097166, 458752, 0, 2228238, 458752, 0, 2359310, 458752, 0, 2490382, 458752, 0, 1835015, 131072, 4, 1835039, 786432, 0, 1835040, 851968, 0) layer_0/tile_data = PackedInt32Array(-1703963, 393216, 0, -1703954, 393216, 0, -1703953, 458752, 2, -393224, 196608, 4, -262152, 196608, 4, -131080, 196608, 4, 196600, 196608, 4, 327672, 196608, 4, 458744, 196608, 4, -458759, 131072, 4, 589817, 458752, 4, -458757, 131072, 4, 589819, 458752, 4, -458755, 131072, 4, 589821, 458752, 4, -524286, 131072, 4, 524290, 458752, 4, -524284, 131072, 4, 524292, 458752, 4, -524282, 131072, 4, 524294, 458752, 4, -458744, 327680, 4, -327672, 327680, 4, -196600, 327680, 4, 131080, 327680, 4, 262152, 327680, 4, 393224, 327680, 4, -589819, 458752, 2, -524294, 458752, 2, -524292, 393216, 2, -589821, 393216, 2, 131070, 458752, 0, 131068, 458752, 0, 131066, 458752, 0, 262142, 458752, 0, 393214, 458752, 0, 327681, 458752, 0, 196609, 458752, 0, 65537, 458752, 0, 65539, 458752, 0, 65541, 458752, 0, -131067, 458752, 0, -131069, 458752, 0, -131071, 458752, 0, -262143, 458752, 0, -393215, 458752, 0, -327682, 458752, 0, -196610, 458752, 0, -65538, 458752, 0, -65540, 458752, 0, -65542, 458752, 0, -1638415, 131072, 4, -1638426, 131072, 4, -1507340, 131072, 4, -1572862, 131072, 4, -1507333, 131072, 4, -1703960, 393216, 2, 1900541, 131072, 4, 1835010, 131072, 4, 1835020, 131072, 4, 1835025, 131072, 4, 2883581, 458752, 4, 2818050, 458752, 4, 2818055, 458752, 4, 2818060, 458752, 4, 2818065, 458752, 4, 2097152, 458752, 0, 2097156, 458752, 0, 2097160, 458752, 0, 2097164, 458752, 0, 2490380, 458752, 0, 2490376, 458752, 0, 2490372, 458752, 0, 2490368, 458752, 0, 2097162, 458752, 0, 2097154, 458752, 0, 2490370, 458752, 0, 2490374, 458752, 0, 2097158, 458752, 0, 2490378, 458752, 0, 2097166, 458752, 0, 2228238, 458752, 0, 2359310, 458752, 0, 2490382, 458752, 0, 1835015, 131072, 4, 1835039, 786432, 0, 1835040, 851968, 0)
@ -603,6 +634,22 @@ position = Vector2(256, -9)
[node name="Campfire2" parent="Entities" index="6" instance=ExtResource("23_mykt8")] [node name="Campfire2" parent="Entities" index="6" instance=ExtResource("23_mykt8")]
position = Vector2(80, 373) position = Vector2(80, 373)
[node name="Centurion" parent="Entities" index="7" instance=ExtResource("30_qfl2k")]
material = SubResource("ShaderMaterial_73smm")
position = Vector2(-360, 31)
[node name="Legionary" parent="Entities" index="8" instance=ExtResource("27_84gw4")]
material = SubResource("ShaderMaterial_o3w21")
position = Vector2(-214, 72)
[node name="Legionary2" parent="Entities" index="9" instance=ExtResource("27_84gw4")]
material = SubResource("ShaderMaterial_gp117")
position = Vector2(-496, 15)
[node name="Legionary3" parent="Entities" index="10" instance=ExtResource("27_84gw4")]
material = SubResource("ShaderMaterial_7e6lj")
position = Vector2(-240, 152)
[editable path="Props/StaticBookshelf"] [editable path="Props/StaticBookshelf"]
[editable path="Props/StaticBookshelf/InteractionTrigger"] [editable path="Props/StaticBookshelf/InteractionTrigger"]
[editable path="Props/StaticBookshelf2"] [editable path="Props/StaticBookshelf2"]

View File

@ -20,7 +20,6 @@ public partial class NPCMoveState : NPCState
public override IState<CharacterState> Enter(IState<CharacterState> prev) public override IState<CharacterState> Enter(IState<CharacterState> prev)
{ {
Character.MovementAnimation.Play("move"); Character.MovementAnimation.Play("move");
GD.Print("playing anim " + Character.MovementAnimation.CurrentAnimation);
return base.Enter(prev); return base.Enter(prev);
} }
} }

View File

@ -51,31 +51,30 @@ public abstract partial class PlayerState : CharacterState
{ {
if (Character.Inventory.SelectedItem is Items.Weapon weapon) if (Character.Inventory.SelectedItem is Items.Weapon weapon)
{ {
var isPressed = Godot.Input.IsActionPressed("attack1"); var isAttack1On = Godot.Input.IsActionPressed("attack1");
var isAttack2On = Godot.Input.IsActionPressed("attack2");
var ret = false;
if (!weapon.IsUsing) if (!weapon.IsUsing)
{ {
var ret = false;
if (!weapon.ShouldHideIdle || isPressed) if (!weapon.ShouldHideIdle || isAttack1On)
{ {
Character.Target = dirToMouse; Character.Target = dirToMouse;
ret = true; ret = true;
} }
if (isPressed)
{
Character.UseCurrentItem();
}
return ret;
} }
else
if (isAttack1On)
{ {
if (!isPressed) Character.UseCurrentItem();
{
Character.DeuseCurrentItem();
}
} }
else if (isAttack2On)
{
Character.UseCurrentItemAlt();
}
return ret;
} }
return false; return false;
} }

View File

@ -5,6 +5,9 @@ namespace SupaLidlGame.State;
public abstract partial class StateMachine<T> : Node where T : Node, IState<T> public abstract partial class StateMachine<T> : Node where T : Node, IState<T>
{ {
[Signal]
public delegate void OnStateChangedEventHandler(Node state);
public T CurrentState { get; protected set; } public T CurrentState { get; protected set; }
public abstract T InitialState { get; set; } public abstract T InitialState { get; set; }

View File

@ -31,12 +31,17 @@ public partial class AttackState : ThinkerState
[Export] [Export]
public float MaxDistanceToTarget { get; set; } public float MaxDistanceToTarget { get; set; }
[Export]
public float UseItemDistance { get; set; } = 40;
[Export] [Export]
public ThinkerState PassiveState { get; set; } public ThinkerState PassiveState { get; set; }
[Export] [Export]
public ThinkerState PursueState { get; set; } public ThinkerState PursueState { get; set; }
protected Characters.Character _bestTarget;
protected float _preferredWeightDistance = 64.0f; protected float _preferredWeightDistance = 64.0f;
protected float _maxWeightDistance = 8.0f; protected float _maxWeightDistance = 8.0f;
protected float _preferredWeightDistanceSq = 4096.0f; protected float _preferredWeightDistanceSq = 4096.0f;
@ -150,6 +155,7 @@ public partial class AttackState : ThinkerState
{ {
// TODO: the entity should wander if it doesn't find a best target // TODO: the entity should wander if it doesn't find a best target
var bestTarget = NPC.FindBestTarget(); var bestTarget = NPC.FindBestTarget();
_bestTarget = bestTarget;
if (bestTarget is not null) if (bestTarget is not null)
{ {
@ -169,12 +175,9 @@ public partial class AttackState : ThinkerState
UpdateWeights(pos); UpdateWeights(pos);
if (dist < 40 && NPC.CanAttack) if (dist <= UseItemDistance && NPC.CanAttack)
{ {
if (NPC.Inventory.SelectedItem is Items.Weapon weapon) Attack(bestTarget);
{
NPC.UseCurrentItem();
}
} }
} }
else else
@ -199,4 +202,12 @@ public partial class AttackState : ThinkerState
return base.Process(delta); return base.Process(delta);
} }
public virtual void Attack(Characters.Character bestTarget)
{
if (NPC.Inventory.SelectedItem is Items.Weapon weapon)
{
NPC.UseCurrentItem();
}
}
} }

View File

@ -0,0 +1,27 @@
using Godot;
using SupaLidlGame.Items.Weapons;
namespace SupaLidlGame.State.Thinker;
public partial class BlockAttackState : AttackState
{
public override void Attack(Characters.Character bestTarget)
{
if (NPC.Inventory.SelectedItem is Sword sword)
{
var stateMachine = sword.StateMachine;
if (bestTarget.StunTime > 0)
{
NPC.UseCurrentItem();
}
else if (bestTarget.Inventory.SelectedItem is not Sword)
{
NPC.UseCurrentItem();
}
else
{
NPC.UseCurrentItemAlt();
}
}
}
}

View File

@ -1,4 +1,5 @@
using Godot; using Godot;
using GodotUtilities;
namespace SupaLidlGame.State.Thinker; namespace SupaLidlGame.State.Thinker;
@ -10,9 +11,33 @@ public partial class IdleState : ThinkerState
[Export] [Export]
public float MinTargetDistance { get; set; } public float MinTargetDistance { get; set; }
[ExportGroup("Line of Sight")]
[Export]
public bool PursueOnLineOfSight { get; set; }
[Export]
public float MinLineOfSightDistance { get; set; }
[ExportGroup("Returning")]
[Export]
public bool ShouldReturnToOriginalPosition { get; set; }
[Export]
public NavigationAgent2D NavigationAgent { get; set; }
protected Vector2 _originalPosition;
protected bool _isReturning;
public override void _Ready()
{
_originalPosition = NPC.GlobalPosition;
base._Ready();
}
public override ThinkerState Think() public override ThinkerState Think()
{ {
var bestTarget = NPC.FindBestTarget(); var bestTarget = NPC.FindBestTarget();
if (bestTarget is not null) if (bestTarget is not null)
{ {
var pos = bestTarget.GlobalPosition; var pos = bestTarget.GlobalPosition;
@ -21,8 +46,46 @@ public partial class IdleState : ThinkerState
{ {
return PursueState; return PursueState;
} }
else if (PursueOnLineOfSight && NPC.HasLineOfSight(bestTarget))
{
if (dist < MinLineOfSightDistance)
{
return PursueState;
}
}
_isReturning = false;
}
if (ShouldReturnToOriginalPosition)
{
if (NavigationAgent is not null)
{
// if we're less than 8 units away then we don't move
var pos = NPC.GlobalPosition;
if (!pos.IsWithinDistanceSquared(_originalPosition, 64))
{
NavigationAgent.TargetPosition = _originalPosition;
}
}
_isReturning = true;
} }
return base.Think(); return base.Think();
} }
public override ThinkerState PhysicsProcess(double delta)
{
if (_isReturning && NavigationAgent.IsTargetReachable())
{
var navPos = NavigationAgent.GetNextPathPosition();
NPC.Direction = NPC.GlobalPosition.DirectionTo(navPos);
}
if (NavigationAgent.IsTargetReached())
{
NPC.Direction = Vector2.Zero;
}
return base.PhysicsProcess(delta);
}
} }

View File

@ -1,4 +1,5 @@
using Godot; using Godot;
using SupaLidlGame.Extensions;
namespace SupaLidlGame.State.Weapon; namespace SupaLidlGame.State.Weapon;
@ -10,6 +11,12 @@ public partial class RangedFireState : WeaponState
[Export] [Export]
public RangedIdleState IdleState { get; set; } public RangedIdleState IdleState { get; set; }
[Export]
public AnimationPlayer AnimationPlayer { get; set; }
[Export]
public string AnimationKey { get; set; }
private double _timeLeft = 0; private double _timeLeft = 0;
public override IState<WeaponState> Enter(IState<WeaponState> prev) public override IState<WeaponState> Enter(IState<WeaponState> prev)
@ -18,6 +25,7 @@ public partial class RangedFireState : WeaponState
_timeLeft = Weapon.UseTime; _timeLeft = Weapon.UseTime;
Weapon.Attack(); Weapon.Attack();
Weapon.UseDirection = Weapon.Character.Target; Weapon.UseDirection = Weapon.Character.Target;
AnimationPlayer?.TryPlay(AnimationKey);
return null; return null;
} }

View File

@ -1,4 +1,5 @@
using Godot; using Godot;
using SupaLidlGame.Extensions;
namespace SupaLidlGame.State.Weapon; namespace SupaLidlGame.State.Weapon;
@ -10,9 +11,17 @@ public partial class RangedIdleState : WeaponState
[Export] [Export]
public Items.Weapons.Ranged Weapon { get; set; } public Items.Weapons.Ranged Weapon { get; set; }
[Export]
public AnimationPlayer AnimationPlayer { get; set; }
[Export]
public string AnimationKey { get; set; }
public override IState<WeaponState> Enter(IState<WeaponState> prev) public override IState<WeaponState> Enter(IState<WeaponState> prev)
{ {
Weapon.Visible = !Weapon.ShouldHideIdle; Weapon.Visible = !Weapon.ShouldHideIdle;
AnimationPlayer?.TryPlay(AnimationKey);
return null; return null;
} }

View File

@ -51,6 +51,7 @@ public partial class SwordAttackState : WeaponState
public override WeaponState Use() public override WeaponState Use()
{ {
/*
if (_useDuration <= 0) if (_useDuration <= 0)
{ {
// if we are still playing the current attack animation, we should alternate // if we are still playing the current attack animation, we should alternate
@ -60,6 +61,7 @@ public partial class SwordAttackState : WeaponState
} }
return IdleState; return IdleState;
} }
*/
return null; return null;
} }

View File

@ -0,0 +1,80 @@
using Godot;
using SupaLidlGame.Extensions;
namespace SupaLidlGame.State.Weapon;
public partial class SwordBlockState : WeaponState
{
[Export]
public SupaLidlGame.Items.Weapons.Sword Sword { get; set; }
[Export]
public SwordIdleState IdleState { get; set; }
[Export]
public WeaponState UseState { get; set; }
[Export]
public string BlockAnimKey { get; set; }
public bool HasBlocked { get; set; }
private double _attackDuration = 0;
private double _useDuration = 0;
private bool _isAlternate = false;
public override WeaponState Enter(IState<WeaponState> prevState)
{
Sword.EnableParry(ulong.MaxValue);
_useDuration = Sword.UseAltTime;
_attackDuration = Sword.AttackAltTime;
Sword.UseDirection = Sword.Character.Target;
Sword.AnimationPlayer.TryPlay(BlockAnimKey);
return null;
}
public override WeaponState Use()
{
if (_attackDuration <= 0 && HasBlocked)
{
return UseState;
}
return null;
}
public void Deattack()
{
Sword.DisableParry();
}
public override void Exit(IState<WeaponState> nextState)
{
Deattack();
HasBlocked = false;
}
public override WeaponState Process(double delta)
{
if (_attackDuration > 0)
{
if ((_attackDuration -= delta) <= 0)
{
Deattack();
}
}
if ((_useDuration -= delta) <= 0)
{
Sword.AnimationPlayer.Play("RESET");
return IdleState;
}
return null;
}
}

View File

@ -5,7 +5,10 @@ namespace SupaLidlGame.State.Weapon;
public partial class SwordIdleState : WeaponState public partial class SwordIdleState : WeaponState
{ {
[Export] [Export]
public SwordAnticipateState AnticipateState { get; set; } public WeaponState UseState { get; set; }
[Export]
public WeaponState UseAltState { get; set; }
[Export] [Export]
public SupaLidlGame.Items.Weapons.Sword Sword { get; set; } public SupaLidlGame.Items.Weapons.Sword Sword { get; set; }
@ -31,12 +34,12 @@ public partial class SwordIdleState : WeaponState
public override WeaponState Use() public override WeaponState Use()
{ {
if (_attackCooldown <= 0) return UseState;
{ }
return AnticipateState;
}
return AnticipateState; public override WeaponState UseAlt()
{
return UseAltState;
} }
public override WeaponState Process(double delta) public override WeaponState Process(double delta)

View File

@ -8,6 +8,10 @@ public abstract partial class WeaponState : Node, IState<WeaponState>
public virtual WeaponState Deuse() => null; public virtual WeaponState Deuse() => null;
public virtual WeaponState UseAlt() => null;
public virtual WeaponState DeuseAlt() => null;
public abstract IState<WeaponState> Enter(IState<WeaponState> previousState); public abstract IState<WeaponState> Enter(IState<WeaponState> previousState);
public virtual void Exit(IState<WeaponState> nextState) public virtual void Exit(IState<WeaponState> nextState)

View File

@ -25,6 +25,24 @@ public partial class WeaponStateMachine : StateMachine<WeaponState>
} }
} }
public void UseAlt()
{
var state = CurrentState.UseAlt();
if (state is WeaponState)
{
ChangeState(state);
}
}
public void DeuseAlt()
{
var state = CurrentState.DeuseAlt();
if (state is WeaponState)
{
ChangeState(state);
}
}
public void Process(double delta) public void Process(double delta)
{ {
var state = CurrentState.Process(delta); var state = CurrentState.Process(delta);

View File

@ -26,12 +26,12 @@ public partial class BossBar : VBoxContainer
BossNameLabel = GetNode<Label>("LabelMargin/BossNameLabel"); BossNameLabel = GetNode<Label>("LabelMargin/BossNameLabel");
} }
private void OnBossHurt(Events.HealthChangedArgs args) private void OnBossHurt(Events.HurtArgs args)
{ {
ProgressBar.Value = args.NewHealth; ProgressBar.Value = args.NewHealth;
} }
private void OnBossDeath(Events.HealthChangedArgs args) private void OnBossDeath(Events.HurtArgs args)
{ {
Visible = false; Visible = false;
Boss = null; Boss = null;

View File

@ -18,7 +18,7 @@ public partial class DamageTime : Node
} }
} }
private void PlayerHurt(Events.HealthChangedArgs args) private void PlayerHurt(Events.HurtArgs args)
{ {
if (args.Damage > 10) if (args.Damage > 10)
{ {

View File

@ -0,0 +1,27 @@
using Godot;
using SupaLidlGame.BoundingBoxes;
using SupaLidlGame.Extensions;
namespace SupaLidlGame.State;
public partial class InteractionTriggerDialogue : Node2D
{
[Export]
public InteractionTrigger InteractionTrigger { get; set; }
[Export(PropertyHint.File, "*.dialogue")]
public Resource DialogueResource { get; set; }
[Export]
public string DialogueTitle { get; set; }
public override void _Ready()
{
InteractionTrigger.Interaction += OnInteraction;
}
private void OnInteraction()
{
this.GetWorld().DialogueBalloon.Start(DialogueResource, DialogueTitle);
}
}

View File

@ -19,3 +19,9 @@ bus/3/mute = false
bus/3/bypass_fx = false bus/3/bypass_fx = false
bus/3/volume_db = 0.0 bus/3/volume_db = 0.0
bus/3/send = &"Master" bus/3/send = &"Master"
bus/4/name = &"UI"
bus/4/solo = false
bus/4/mute = false
bus/4/bypass_fx = false
bus/4/volume_db = 0.0
bus/4/send = &"Master"

View File

@ -42,7 +42,7 @@ project/assembly_name="SupaLidlGame"
[editor_plugins] [editor_plugins]
enabled=PackedStringArray("res://addons/dialogue_manager/plugin.cfg", "res://addons/panku_console/plugin.cfg") enabled=PackedStringArray("res://addons/panku_console/plugin.cfg", "res://addons/dialogue_manager/plugin.cfg")
[input] [input]
@ -87,6 +87,11 @@ attack1={
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"pressed":false,"double_click":false,"script":null) "events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"pressed":false,"double_click":false,"script":null)
] ]
} }
attack2={
"deadzone": 0.5,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":2,"pressed":false,"double_click":false,"script":null)
]
}
equip={ equip={
"deadzone": 0.5, "deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":69,"key_label":0,"unicode":0,"echo":false,"script":null) "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":69,"key_label":0,"unicode":0,"echo":false,"script":null)