extends Camera2D

export var shake_time = 0
export var shake_intensity = 0

var time_passed = 0

func _physics_process(delta):
	time_passed += delta
	
	if time_passed > shake_time:
		self.offset = Vector2(0, 0)

func shake():
	shake_time = 0.2
	shake_intensity = 1
	
	time_passed = 0
	
	self.offset = Vector2(
		rand_range(-shake_intensity, shake_intensity),
		rand_range(-shake_intensity, shake_intensity))
