From a07642c3af78936d03f1ffc1ad10ac881db62edb Mon Sep 17 00:00:00 2001 From: HumanoidSandvichDispenser Date: Sat, 2 Sep 2023 22:53:36 -0700 Subject: [PATCH] added OpenGL-compatible shaders; solves #13 --- Assets/Sprites/Particles/ParryParticles.tres | 29 +++++++++----- Items/Weapons/DocLance.tscn | 33 +++++----------- Items/Weapons/Pugio.tscn | 39 +++++-------------- Items/Weapons/Sword.tscn | 41 +++++++------------- 4 files changed, 53 insertions(+), 89 deletions(-) diff --git a/Assets/Sprites/Particles/ParryParticles.tres b/Assets/Sprites/Particles/ParryParticles.tres index 7b255aa..5bebde8 100644 --- a/Assets/Sprites/Particles/ParryParticles.tres +++ b/Assets/Sprites/Particles/ParryParticles.tres @@ -1,4 +1,4 @@ -[gd_resource type="ParticleProcessMaterial" load_steps=5 format=3 uid="uid://cbfaqolx1ydvv"] +[gd_resource type="ParticleProcessMaterial" load_steps=7 format=3 uid="uid://cbfaqolx1ydvv"] [sub_resource type="Gradient" id="Gradient_44upg"] offsets = PackedFloat32Array(0, 0.5) @@ -7,16 +7,27 @@ colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 0) [sub_resource type="GradientTexture1D" id="GradientTexture1D_droiy"] gradient = SubResource("Gradient_44upg") -[sub_resource type="Curve" id="Curve_4kf4j"] -_data = [Vector2(0, 0.5), 0.0, 0.0, 0, 0, Vector2(0.1, 1), 0.0, 0.0, 0, 0, Vector2(1, 0.5), 0.0, 0.0, 0, 0] -point_count = 3 +[sub_resource type="Curve" id="Curve_mx7gl"] +_data = [Vector2(0, 0.3), 0.0, 0.0, 0, 1, Vector2(1, 0.3), 0.0, 0.0, 1, 0] +point_count = 2 -[sub_resource type="CurveTexture" id="CurveTexture_qqrjb"] -curve = SubResource("Curve_4kf4j") +[sub_resource type="Curve" id="Curve_lfa60"] +_data = [Vector2(0.1, 1), 0.0, -1.75, 0, 1, Vector2(0.5, 0.3), -1.75, 0.0, 1, 0] +point_count = 2 + +[sub_resource type="Curve" id="Curve_3iug1"] +_data = [Vector2(0, 1), 0.0, 0.0, 0, 1, Vector2(1, 1), 0.0, 0.0, 1, 0] +point_count = 2 + +[sub_resource type="CurveXYZTexture" id="CurveXYZTexture_xryvh"] +curve_x = SubResource("Curve_mx7gl") +curve_y = SubResource("Curve_lfa60") +curve_z = SubResource("Curve_3iug1") [resource] emission_shape = 1 emission_sphere_radius = 4.0 +particle_flag_align_y = true particle_flag_disable_z = true spread = 180.0 gravity = Vector3(0, 0, 0) @@ -26,7 +37,7 @@ orbit_velocity_min = 0.0 orbit_velocity_max = 0.0 linear_accel_min = -512.0 linear_accel_max = -512.0 -scale_min = 2.0 -scale_max = 2.0 -scale_curve = SubResource("CurveTexture_qqrjb") +scale_min = 0.1 +scale_max = 0.1 +scale_curve = SubResource("CurveXYZTexture_xryvh") color_ramp = SubResource("GradientTexture1D_droiy") diff --git a/Items/Weapons/DocLance.tscn b/Items/Weapons/DocLance.tscn index 0ad753e..0225d38 100644 --- a/Items/Weapons/DocLance.tscn +++ b/Items/Weapons/DocLance.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=21 format=3 uid="uid://p7oijq6dbvvk"] +[gd_scene load_steps=22 format=3 uid="uid://p7oijq6dbvvk"] [ext_resource type="Script" path="res://Items/Weapons/Sword.cs" id="1_1oyma"] [ext_resource type="Script" path="res://State/Weapon/WeaponStateMachine.cs" id="2_c41ov"] @@ -6,6 +6,7 @@ [ext_resource type="Script" path="res://State/Weapon/SwordAnticipateState.cs" id="4_t7af2"] [ext_resource type="Script" path="res://State/Weapon/SwordAttackState.cs" id="5_i5v42"] [ext_resource type="Texture2D" uid="uid://o7enu13gvji5" path="res://Assets/Sprites/doc-lance.png" id="6_7t87o"] +[ext_resource type="Texture2D" uid="uid://d75jkoev5v3w" path="res://Assets/Sprites/Particles/circle-64.png" id="8_gufhv"] [ext_resource type="Material" uid="uid://cbfaqolx1ydvv" path="res://Assets/Sprites/Particles/ParryParticles.tres" id="8_y2qyn"] [ext_resource type="PackedScene" uid="uid://du5vhccg75nrq" path="res://BoundingBoxes/Hitbox.tscn" id="9_buajm"] [ext_resource type="Texture2D" uid="uid://cmvh6pc71ir1m" path="res://Assets/Sprites/sword-swing-large.png" id="11_46l1i"] @@ -183,46 +184,33 @@ _data = { [sub_resource type="RectangleShape2D" id="RectangleShape2D_rrgwb"] size = Vector2(10, 34) -[node name="DocLance" type="Node2D" node_paths=PackedStringArray("Hitbox", "AnimationPlayer", "ParryParticles", "StateMachine", "Anchor", "HandAnchor")] +[node name="DocLance" type="Node2D"] y_sort_enabled = true texture_filter = 3 script = ExtResource("1_1oyma") -Hitbox = NodePath("Hitbox") -AnimationPlayer = NodePath("AnimationPlayer") AttackTime = 0.2 AttackAnimationDuration = 0.75 -ParryParticles = NodePath("Anchor/Node2D/Sprite2D/ParryParticles") NPCAnticipateTime = 0.3 -StateMachine = NodePath("State") -Anchor = NodePath("Anchor") Damage = 20.0 UseTime = 0.55 Knockback = 64.0 ShouldHideIdle = true -HandAnchor = NodePath("Anchor/Node2D/Sprite2D/Hand") ItemName = "VSM-93" Description = "\"Violence. Speed. Momentum.\"" -[node name="State" type="Node" parent="." node_paths=PackedStringArray("InitialState")] +[node name="State" type="Node" parent="."] script = ExtResource("2_c41ov") -InitialState = NodePath("Idle") UsedItemStates = Array[NodePath]([NodePath("Attack")]) DeusedItemStates = Array[NodePath]([NodePath("Idle")]) -[node name="Idle" type="Node" parent="State" node_paths=PackedStringArray("UseState", "Sword")] +[node name="Idle" type="Node" parent="State"] script = ExtResource("3_sxffm") -UseState = NodePath("../Anticipate") -Sword = NodePath("../..") -[node name="Anticipate" type="Node" parent="State" node_paths=PackedStringArray("Sword", "AttackState")] +[node name="Anticipate" type="Node" parent="State"] script = ExtResource("4_t7af2") -Sword = NodePath("../..") -AttackState = NodePath("../Attack") -[node name="Attack" type="Node" parent="State" node_paths=PackedStringArray("Sword", "IdleState")] +[node name="Attack" type="Node" parent="State"] script = ExtResource("5_i5v42") -Sword = NodePath("../..") -IdleState = NodePath("../Idle") [node name="Anchor" type="Node2D" parent="."] y_sort_enabled = true @@ -239,17 +227,14 @@ texture = ExtResource("6_7t87o") [node name="ParryParticles" type="GPUParticles2D" parent="Anchor/Node2D/Sprite2D"] modulate = Color(1.2, 1.2, 1.2, 1) -position = Vector2(-0.221825, -3.12132) +position = Vector2(0, -3) rotation = 0.785398 -emitting = false amount = 16 process_material = ExtResource("8_y2qyn") +texture = ExtResource("8_gufhv") lifetime = 2.0 one_shot = true explosiveness = 1.0 -trail_enabled = true -trail_lifetime = 0.1 -trail_sections = 4 [node name="GPUParticles2D" type="GPUParticles2D" parent="Anchor/Node2D/Sprite2D"] position = Vector2(-2.28882e-05, -6) diff --git a/Items/Weapons/Pugio.tscn b/Items/Weapons/Pugio.tscn index eb037f8..a3f393a 100644 --- a/Items/Weapons/Pugio.tscn +++ b/Items/Weapons/Pugio.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=28 format=3 uid="uid://5y1acxl4j4n7"] +[gd_scene load_steps=29 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"] @@ -8,6 +8,7 @@ [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="Texture2D" uid="uid://d75jkoev5v3w" path="res://Assets/Sprites/Particles/circle-64.png" id="9_3p5s2"] [ext_resource type="AudioStream" uid="uid://m1sbk3c4eask" path="res://Assets/Sounds/metal-bash2.wav" id="9_b6yro"] [ext_resource type="PackedScene" uid="uid://du5vhccg75nrq" path="res://BoundingBoxes/Hitbox.tscn" id="9_qimey"] [ext_resource type="AudioStream" uid="uid://kao8wbfaum27" path="res://Assets/Sounds/metal-bash3.wav" id="10_istfq"] @@ -369,52 +370,35 @@ 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")] +[node name="Pugio" type="Node2D"] 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")] +[node name="State" type="Node" parent="."] script = ExtResource("2_5ramr") -InitialState = NodePath("Idle") UsedItemStates = Array[NodePath]([NodePath("Attack"), NodePath("Block")]) DeusedItemStates = Array[NodePath]([NodePath("Idle")]) -[node name="Idle" type="Node" parent="State" node_paths=PackedStringArray("UseState", "UseAltState", "Sword")] +[node name="Idle" type="Node" parent="State"] script = ExtResource("3_fwkit") -UseState = NodePath("../Anticipate") -UseAltState = NodePath("../Block") -Sword = NodePath("../..") -[node name="Anticipate" type="Node" parent="State" node_paths=PackedStringArray("Sword", "AttackState")] +[node name="Anticipate" type="Node" parent="State"] script = ExtResource("4_nsn1q") -Sword = NodePath("../..") -AttackState = NodePath("../Attack") -[node name="Attack" type="Node" parent="State" node_paths=PackedStringArray("Sword", "IdleState")] +[node name="Attack" type="Node" parent="State"] script = ExtResource("5_g1en5") -Sword = NodePath("../..") -IdleState = NodePath("../Idle") -[node name="Block" type="Node" parent="State" node_paths=PackedStringArray("Sword", "IdleState", "UseState")] +[node name="Block" type="Node" parent="State"] script = ExtResource("6_yvm8x") -Sword = NodePath("../..") -IdleState = NodePath("../Idle") -UseState = NodePath("../Anticipate") BlockAnimKey = "block" [node name="WorldEnvironment" type="WorldEnvironment" parent="."] @@ -435,17 +419,14 @@ 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) +position = Vector2(0, -3) rotation = 0.785398 -emitting = false amount = 16 process_material = ExtResource("8_we1sv") +texture = ExtResource("9_3p5s2") 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) diff --git a/Items/Weapons/Sword.tscn b/Items/Weapons/Sword.tscn index daf9f45..2c7bb84 100644 --- a/Items/Weapons/Sword.tscn +++ b/Items/Weapons/Sword.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=36 format=3 uid="uid://dvqap2uhcah63"] +[gd_scene load_steps=37 format=3 uid="uid://dvqap2uhcah63"] [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"] @@ -10,6 +10,7 @@ [ext_resource type="Script" path="res://State/Weapon/SwordAttackState.cs" id="5_hmisb"] [ext_resource type="AudioStream" uid="uid://c4n7ioxpukdwi" path="res://Assets/Sounds/parry.wav" id="6_8nxjm"] [ext_resource type="Material" uid="uid://cbfaqolx1ydvv" path="res://Assets/Sprites/Particles/ParryParticles.tres" id="8_10gir"] +[ext_resource type="Texture2D" uid="uid://d75jkoev5v3w" path="res://Assets/Sprites/Particles/circle-64.png" id="9_o34ry"] [ext_resource type="Shape2D" uid="uid://dw4e4r2yxwk1b" path="res://Items/Weapons/SwordCollisionShape.tres" id="9_wsprl"] [ext_resource type="Texture2D" uid="uid://cmvh6pc71ir1m" path="res://Assets/Sprites/sword-swing-large.png" id="10_672jv"] [ext_resource type="AudioStream" uid="uid://qvthq6tppp63" path="res://Assets/Sounds/whoosh.wav" id="10_mfnl7"] @@ -353,44 +354,31 @@ 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"] y_sort_enabled = true texture_filter = 3 script = ExtResource("1_mlo73") -Hitbox = NodePath("Hitbox") -AnimationPlayer = NodePath("AnimationPlayer") AttackTime = 0.2 AttackAnimationDuration = 0.75 -ParryParticles = NodePath("Anchor/Node2D/Sprite2D/ParryParticles") NPCAnticipateTime = 0.3 -StateMachine = NodePath("State") -Anchor = NodePath("Anchor") Damage = 20.0 UseTime = 0.55 Knockback = 64.0 ShouldHideIdle = true -HandAnchor = NodePath("Anchor/Node2D/Sprite2D/Hand") -[node name="State" type="Node" parent="." node_paths=PackedStringArray("InitialState")] +[node name="State" type="Node" parent="."] script = ExtResource("2_vwirq") -InitialState = NodePath("Idle") UsedItemStates = Array[NodePath]([NodePath("Attack")]) DeusedItemStates = Array[NodePath]([NodePath("Idle")]) -[node name="Idle" type="Node" parent="State" node_paths=PackedStringArray("UseState", "Sword")] +[node name="Idle" type="Node" parent="State"] script = ExtResource("3_nw6r0") -UseState = NodePath("../Anticipate") -Sword = NodePath("../..") -[node name="Anticipate" type="Node" parent="State" node_paths=PackedStringArray("Sword", "AttackState")] +[node name="Anticipate" type="Node" parent="State"] script = ExtResource("4_j3cud") -Sword = NodePath("../..") -AttackState = NodePath("../Attack") -[node name="Attack" type="Node" parent="State" node_paths=PackedStringArray("Sword", "IdleState")] +[node name="Attack" type="Node" parent="State"] script = ExtResource("5_hmisb") -Sword = NodePath("../..") -IdleState = NodePath("../Idle") [node name="WorldEnvironment" type="WorldEnvironment" parent="."] environment = SubResource("Environment_72txp") @@ -414,23 +402,22 @@ y_sort_enabled = true position = Vector2(0, -8) texture = ExtResource("3_r75ni") +[node name="Hand" type="Sprite2D" parent="Anchor/Node2D/Sprite2D"] +position = Vector2(-2.52724e-05, 7) +rotation = 1.5708 + [node name="ParryParticles" type="GPUParticles2D" parent="Anchor/Node2D/Sprite2D"] modulate = Color(1.2, 1.2, 1.2, 1) -position = Vector2(-0.221825, -3.12132) +position = Vector2(0, -3) rotation = 0.785398 emitting = false amount = 16 process_material = ExtResource("8_10gir") +texture = ExtResource("9_o34ry") 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 +fixed_fps = 16 [node name="AnimationPlayer" type="AnimationPlayer" parent="."] libraries = {