diff --git a/Hiro/hiro_ai.tscn b/Hiro/hiro_ai.tscn index 86c6496..7df9a8c 100644 --- a/Hiro/hiro_ai.tscn +++ b/Hiro/hiro_ai.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=53 format=3 uid="uid://dd2km6qhpdicx"] +[gd_scene load_steps=55 format=3 uid="uid://dd2km6qhpdicx"] [ext_resource type="Script" path="res://Scripts/hiro_ai.gd" id="1_inmen"] +[ext_resource type="Shader" uid="uid://bcnip762rd6yj" path="res://Shaders/character.tres" id="2_6u0oh"] [ext_resource type="Texture2D" uid="uid://cm7tgomrcvq30" path="res://Hiro/Hiro Walk Sprite Cycle Line Up.png" id="2_ctdbh"] [ext_resource type="AnimationLibrary" uid="uid://dincs5x4qucal" path="res://Hiro/hiro_animation.tres" id="3_umwtx"] [ext_resource type="Script" path="res://addons/godot_state_charts/state_chart.gd" id="6_i4c04"] @@ -9,6 +10,10 @@ [ext_resource type="Script" path="res://addons/godot_state_charts/expression_guard.gd" id="9_ak1rc"] [ext_resource type="Script" path="res://addons/godot_state_charts/transition.gd" id="9_la16b"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_7ckhc"] +shader = ExtResource("2_6u0oh") +shader_parameter/FlashColor = Color(1, 0, 0, 0) + [sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_tyc74"] animation = &"hurt_west" @@ -223,6 +228,7 @@ script = ExtResource("1_inmen") [node name="Sprite2D" type="Sprite2D" parent="."] modulate = Color(0.498039, 0.498039, 0.498039, 1) texture_filter = 1 +material = SubResource("ShaderMaterial_7ckhc") position = Vector2(0, -13) texture = ExtResource("2_ctdbh") hframes = 20 diff --git a/Hiro/hiro_animation.tres b/Hiro/hiro_animation.tres index 8e6f749..837ed77 100644 --- a/Hiro/hiro_animation.tres +++ b/Hiro/hiro_animation.tres @@ -90,6 +90,18 @@ tracks/6/keys = { "update": 1, "values": [true] } +tracks/7/type = "value" +tracks/7/imported = false +tracks/7/enabled = true +tracks/7/path = NodePath("Sprite2D:material:shader_parameter/FlashColor") +tracks/7/interp = 1 +tracks/7/loop_wrap = true +tracks/7/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(1, 0, 0, 0)] +} [sub_resource type="Animation" id="Animation_kvnht"] resource_name = "hurt_east" @@ -143,6 +155,18 @@ tracks/3/keys = { "update": 1, "values": [6, 7, 8, 9] } +tracks/4/type = "value" +tracks/4/imported = false +tracks/4/enabled = true +tracks/4/path = NodePath("Sprite2D:material:shader_parameter/FlashColor") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/keys = { +"times": PackedFloat32Array(0, 0.5), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Color(1, 0, 0, 1), Color(1, 0, 0, 0)] +} [sub_resource type="Animation" id="Animation_fytkh"] resource_name = "hurt_north" @@ -196,6 +220,18 @@ tracks/3/keys = { "update": 1, "values": [10, 11, 12, 13] } +tracks/4/type = "value" +tracks/4/imported = false +tracks/4/enabled = true +tracks/4/path = NodePath("Sprite2D:material:shader_parameter/FlashColor") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/keys = { +"times": PackedFloat32Array(0, 0.5), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Color(1, 0, 0, 1), Color(1, 0, 0, 0)] +} [sub_resource type="Animation" id="Animation_lw5of"] resource_name = "hurt_south" @@ -249,6 +285,18 @@ tracks/3/keys = { "update": 1, "values": [1, 2, 3, 4] } +tracks/4/type = "value" +tracks/4/imported = false +tracks/4/enabled = true +tracks/4/path = NodePath("Sprite2D:material:shader_parameter/FlashColor") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/keys = { +"times": PackedFloat32Array(0, 0.5), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Color(1, 0, 0, 1), Color(1, 0, 0, 0)] +} [sub_resource type="Animation" id="Animation_htnmm"] resource_name = "hurt_west" @@ -302,6 +350,18 @@ tracks/3/keys = { "update": 1, "values": [16, 17, 18, 19] } +tracks/4/type = "value" +tracks/4/imported = false +tracks/4/enabled = true +tracks/4/path = NodePath("Sprite2D:material:shader_parameter/FlashColor") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/keys = { +"times": PackedFloat32Array(0, 0.5), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Color(1, 0, 0, 0.987594), Color(1, 0, 0, 0)] +} [sub_resource type="Animation" id="Animation_3oagy"] resource_name = "idle_east" diff --git a/Hiro/hiro_player.tscn b/Hiro/hiro_player.tscn index 1c7a4c7..c0d4bb9 100644 --- a/Hiro/hiro_player.tscn +++ b/Hiro/hiro_player.tscn @@ -1,9 +1,15 @@ -[gd_scene load_steps=45 format=3 uid="uid://di21xheryhp0k"] +[gd_scene load_steps=47 format=3 uid="uid://di21xheryhp0k"] [ext_resource type="Script" path="res://Scripts/hiro_player.gd" id="1_dtymi"] [ext_resource type="Texture2D" uid="uid://cm7tgomrcvq30" path="res://Hiro/Hiro Walk Sprite Cycle Line Up.png" id="1_ukwcc"] +[ext_resource type="Shader" uid="uid://bcnip762rd6yj" path="res://Shaders/character.tres" id="2_tyej0"] [ext_resource type="AnimationLibrary" uid="uid://dincs5x4qucal" path="res://Hiro/hiro_animation.tres" id="3_ucyqo"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_ftlgj"] +resource_local_to_scene = true +shader = ExtResource("2_tyej0") +shader_parameter/FlashColor = Color(1, 0, 0, 0) + [sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_tyc74"] animation = &"hurt_west" @@ -186,7 +192,7 @@ states/melee/position = Vector2(329, 224) states/walk/node = SubResource("AnimationNodeBlendSpace2D_vunsg") states/walk/position = Vector2(520, 108) transitions = ["Start", "idle", SubResource("AnimationNodeStateMachineTransition_akmuq"), "idle", "walk", SubResource("AnimationNodeStateMachineTransition_sn1tm"), "walk", "idle", SubResource("AnimationNodeStateMachineTransition_5i3fu"), "idle", "melee", SubResource("AnimationNodeStateMachineTransition_y8p74"), "melee", "idle", SubResource("AnimationNodeStateMachineTransition_l17k0"), "hurt", "idle", SubResource("AnimationNodeStateMachineTransition_ln3pc")] -graph_offset = Vector2(-241, 18) +graph_offset = Vector2(-239, -26) [sub_resource type="CapsuleShape2D" id="CapsuleShape2D_vm050"] radius = 8.0 @@ -205,6 +211,7 @@ script = ExtResource("1_dtymi") [node name="Sprite2D" type="Sprite2D" parent="."] texture_filter = 1 +material = SubResource("ShaderMaterial_ftlgj") position = Vector2(0, -13) texture = ExtResource("1_ukwcc") hframes = 20 diff --git a/Shaders/character.tres b/Shaders/character.tres new file mode 100644 index 0000000..94f5a76 --- /dev/null +++ b/Shaders/character.tres @@ -0,0 +1,55 @@ +[gd_resource type="VisualShader" load_steps=4 format=3 uid="uid://bcnip762rd6yj"] + +[sub_resource type="VisualShaderNodeColorParameter" id="VisualShaderNodeColorParameter_llme6"] +expanded_output_ports = [0] +parameter_name = "FlashColor" + +[sub_resource type="VisualShaderNodeInput" id="VisualShaderNodeInput_k72xm"] +expanded_output_ports = [0] +input_name = "color" + +[sub_resource type="VisualShaderNodeMix" id="VisualShaderNodeMix_oth8y"] +default_input_values = [0, Vector3(0, 0, 0), 1, Vector3(1, 1, 1), 2, Vector3(0, 0, 0)] +op_type = 3 + +[resource] +code = "shader_type canvas_item; +render_mode blend_mix; + +uniform vec4 FlashColor : source_color; + + + +void fragment() { +// Input:3 + vec4 n_out3p0 = COLOR; + float n_out3p4 = n_out3p0.a; + + +// ColorParameter:2 + vec4 n_out2p0 = FlashColor; + float n_out2p4 = n_out2p0.a; + + +// Mix:4 + vec3 n_out4p0 = mix(vec3(n_out3p0.xyz), vec3(n_out2p0.xyz), vec3(n_out2p4)); + + +// Output:0 + COLOR.rgb = n_out4p0; + COLOR.a = n_out3p4; + + +} +" +graph_offset = Vector2(-103.937, -135.818) +mode = 1 +flags/light_only = false +nodes/fragment/0/position = Vector2(600, -60) +nodes/fragment/2/node = SubResource("VisualShaderNodeColorParameter_llme6") +nodes/fragment/2/position = Vector2(-40, 140) +nodes/fragment/3/node = SubResource("VisualShaderNodeInput_k72xm") +nodes/fragment/3/position = Vector2(-60, -60) +nodes/fragment/4/node = SubResource("VisualShaderNodeMix_oth8y") +nodes/fragment/4/position = Vector2(300, 100) +nodes/fragment/connections = PackedInt32Array(3, 4, 0, 1, 3, 0, 4, 0, 2, 0, 4, 1, 4, 0, 0, 0, 2, 4, 4, 2)