subtle flashlight flicker
This commit is contained in:
parent
afcb3bb146
commit
a35dffc622
|
@ -1,5 +1,19 @@
|
|||
extends SpotLight
|
||||
|
||||
var timer = null
|
||||
|
||||
func _ready():
|
||||
randomize()
|
||||
timer = Timer.new()
|
||||
timer.wait_time = rand_range(0.1, 0.2)
|
||||
timer.connect("timeout", self, "on_timer_timeout")
|
||||
add_child(timer)
|
||||
timer.start()
|
||||
|
||||
func on_timer_timeout():
|
||||
timer.wait_time = rand_range(0.05, 0.15)
|
||||
self.light_energy = rand_range(1.25, 1.5)
|
||||
|
||||
func _input(_event):
|
||||
if Input.is_action_just_pressed("toggle_flashlight"):
|
||||
toggle()
|
||||
|
|
Loading…
Reference in New Issue