aboutsummaryrefslogtreecommitdiff
path: root/scripts/fx
diff options
context:
space:
mode:
authorjacopograndi <jacopo.grandi@outlook.it>2021-12-09 00:52:59 +0100
committerjacopograndi <jacopo.grandi@outlook.it>2021-12-09 00:52:59 +0100
commit0f518727c28d3204415db14c7ca0e4f7cb653677 (patch)
treea595121771b69a52f17154d8e5c61b7e4b2b8190 /scripts/fx
working
Diffstat (limited to 'scripts/fx')
-rw-r--r--scripts/fx/fx_enemy_damage.gd29
1 files changed, 29 insertions, 0 deletions
diff --git a/scripts/fx/fx_enemy_damage.gd b/scripts/fx/fx_enemy_damage.gd
new file mode 100644
index 0000000..48f4629
--- /dev/null
+++ b/scripts/fx/fx_enemy_damage.gd
@@ -0,0 +1,29 @@
+extends Spatial
+
+var timer = 0
+var timer_life = 0.5
+
+var anim_size = 1
+
+var _mesh : MeshInstance
+
+var base
+
+func refresh_shader(mat):
+ _mesh = get_child(0).get_child(0)
+ _mesh.set_surface_material(0, mat)
+
+func refresh_basis():
+ base = transform.basis
+
+func _physics_process(delta):
+ timer += delta
+ if timer > timer_life:
+ queue_free()
+
+ var amt = timer / timer_life
+
+ _mesh.get_active_material(0).set_shader_param("offset", amt)
+
+ anim_size = 1+ amt * 0.1
+ transform.basis = base.scaled(Vector3(anim_size, anim_size, anim_size))