diff options
Diffstat (limited to 'Scenes/Entity.gd')
-rw-r--r-- | Scenes/Entity.gd | 18 |
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") |