Fixed shader lag issue

main
Hecht 2 years ago
parent f68c5ca0a2
commit 1877acabed

@ -18,7 +18,6 @@ var stamina:int = 100
@export @export
var descriptor:String = "Foo" var descriptor:String = "Foo"
var _material = null
var _material_counter = 0 var _material_counter = 0
var _actions = [] var _actions = []
@ -42,8 +41,7 @@ func is_animation_done() -> bool:
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
_material = _animation_sprite.material; _animation_sprite.material.set_shader_parameter("aura_width", 0)
_animation_sprite.material = null
_animation_sprite.flip_h = orientation _animation_sprite.flip_h = orientation
_animation_player.play("RESET") _animation_player.play("RESET")
@ -79,7 +77,7 @@ func _on_next_round():
_material_counter -= 1 _material_counter -= 1
if _material_counter == 0: if _material_counter == 0:
_animation_sprite.material = null _animation_sprite.material.set_shader_parameter("aura_width", 0)
func _schedule_next_action(): func _schedule_next_action():
if _animation_player.is_playing(): if _animation_player.is_playing():
@ -108,7 +106,7 @@ func _on_animation_finished(anim_name):
if (anim_name == "PowerUp"): if (anim_name == "PowerUp"):
_animation_sprite.frame = 0 _animation_sprite.frame = 0
_animation_sprite.material = _material _animation_sprite.material.set_shader_parameter("aura_width", 1)
_material_counter = 3 _material_counter = 3
func _on_animation_started(anim_name): func _on_animation_started(anim_name):

@ -6,8 +6,9 @@
[ext_resource type="PackedScene" uid="uid://blhw157wwm02k" path="res://DamageLabel.tscn" id="3_nllc3"] [ext_resource type="PackedScene" uid="uid://blhw157wwm02k" path="res://DamageLabel.tscn" id="3_nllc3"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_r07wr"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_r07wr"]
resource_local_to_scene = true
shader = ExtResource("2_tgww4") shader = ExtResource("2_tgww4")
shader_parameter/aura_width = 1.0 shader_parameter/aura_width = 0.0
shader_parameter/aura_color = Color(0.631373, 1, 0.827451, 1) shader_parameter/aura_color = Color(0.631373, 1, 0.827451, 1)
[sub_resource type="Animation" id="Animation_uyuin"] [sub_resource type="Animation" id="Animation_uyuin"]
@ -138,6 +139,21 @@ tracks/0/keys = {
"values": [34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50] "values": [34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]
} }
[sub_resource type="Animation" id="Animation_u40bv"]
resource_name = "PowerUp"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D: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, 0.6, 0.7, 0.8, 0.9),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [127, 128, 129, 130, 127, 128, 129, 130, 127, 128]
}
[sub_resource type="Animation" id="Animation_hs612"] [sub_resource type="Animation" id="Animation_hs612"]
length = 0.001 length = 0.001
tracks/0/type = "value" tracks/0/type = "value"
@ -200,21 +216,6 @@ tracks/0/keys = {
"values": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24] "values": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]
} }
[sub_resource type="Animation" id="Animation_u40bv"]
resource_name = "PowerUp"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D: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, 0.6, 0.7, 0.8, 0.9),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [127, 128, 129, 130, 127, 128, 129, 130, 127, 128]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_jbrqc"] [sub_resource type="AnimationLibrary" id="AnimationLibrary_jbrqc"]
_data = { _data = {
"Attack1.1": SubResource("Animation_uyuin"), "Attack1.1": SubResource("Animation_uyuin"),

Loading…
Cancel
Save