summaryrefslogtreecommitdiff
path: root/Scenes/Entity.gd
diff options
context:
space:
mode:
authorVictor Andrade de Almeida <vct.a.almeida@gmail.com>2022-07-16 18:31:13 -0300
committerVictor Andrade de Almeida <vct.a.almeida@gmail.com>2022-07-16 18:31:27 -0300
commit5b432198140f06d427079a6c8160b2c525b5eb0f (patch)
tree2aee9d93c7f2156d6bdc27e9917c458d196ff9dd /Scenes/Entity.gd
parent3b28b4585b5272a4c72a2c89f02f4441945e03fd (diff)
downloadgamejam-gmtk-2022-5b432198140f06d427079a6c8160b2c525b5eb0f.tar.gz
gamejam-gmtk-2022-5b432198140f06d427079a6c8160b2c525b5eb0f.tar.bz2
gamejam-gmtk-2022-5b432198140f06d427079a6c8160b2c525b5eb0f.zip
Add damage pressure plates
Diffstat (limited to 'Scenes/Entity.gd')
-rw-r--r--Scenes/Entity.gd18
1 files changed, 18 insertions, 0 deletions
diff --git a/Scenes/Entity.gd b/Scenes/Entity.gd
index a13c23b..9698189 100644
--- a/Scenes/Entity.gd
+++ b/Scenes/Entity.gd
@@ -44,3 +44,21 @@ func cor_move(args : Array): # args = [Vector3]
func cor_dies(args : Array):
yield()
+
+func cor_shake(args : Array):
+ var duration = args[0]
+ var time = 0
+
+ var zero = Vector3(0, 0.5, 0)
+ var intensity = 0.02
+
+ while true:
+ time = min(time + get_process_delta_time(), duration)
+
+ translation = zero + (2 * Vector3(randf(), randf(), randf()) - Vector3.ONE) * intensity
+
+ if time >= duration:
+ translation = zero
+ break
+
+ yield(get_tree(), "idle_frame")