added Graphics and sound Effects and more overhauls
This commit is contained in:
parent
c887a2168c
commit
b9d4288900
214 changed files with 3378 additions and 198 deletions
22
scenes/spaceShip/player/camera2d.gd
Normal file
22
scenes/spaceShip/player/camera2d.gd
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
extends Camera2D
|
||||
|
||||
var shake_duration: float = 0.5
|
||||
var shake_magnitude: float = 10.0
|
||||
var shake_timer: float = 0.0
|
||||
var original_position: Vector2
|
||||
|
||||
func _ready():
|
||||
original_position = position
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if shake_timer > 0:
|
||||
shake_timer -= delta
|
||||
var offset = Vector2(randf_range(-shake_magnitude, shake_magnitude), randf_range(-shake_magnitude, shake_magnitude))
|
||||
position = original_position + offset
|
||||
else:
|
||||
position = original_position
|
||||
|
||||
func shake(duration: float, magnitude: float) -> void:
|
||||
shake_duration = duration
|
||||
shake_magnitude = magnitude
|
||||
shake_timer = shake_duration
|
||||
Loading…
Add table
Add a link
Reference in a new issue