diff options
Diffstat (limited to 'Scenes/Player.gd')
-rw-r--r-- | Scenes/Player.gd | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/Scenes/Player.gd b/Scenes/Player.gd index b94afa6..145af4f 100644 --- a/Scenes/Player.gd +++ b/Scenes/Player.gd @@ -65,7 +65,7 @@ func get_cardinal(direction: Vector2): func get_upper_face(): return get_top() -func cor_move(args : Array): # args = [Vector3] +func cor_move(args : Array): # args = [Vector3, float] var pos_a = translation var pos_b = args[0] @@ -74,7 +74,7 @@ func cor_move(args : Array): # args = [Vector3] var basis_a = mesh.transform.basis var basis_b = basis_a.rotated(Vector3(dir.z, 0, -dir.x), PI / 2) - var duration = 0.2 + var duration = args[1] var time = 0 while true: @@ -89,3 +89,21 @@ func cor_move(args : Array): # args = [Vector3] break yield(get_tree(), "idle_frame") + +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) + + mesh.translation = zero + (2 * Vector3(randf(), randf(), randf()) - Vector3.ONE) * intensity + + if time >= duration: + mesh.translation = zero + break + + yield(get_tree(), "idle_frame") |