23 lines
440 B
GDScript
23 lines
440 B
GDScript
extends Spatial
|
|
|
|
var _timer = null
|
|
var _thisloop = true
|
|
|
|
func _ready():
|
|
_timer = Timer.new()
|
|
add_child(_timer)
|
|
|
|
_timer.connect("timeout", self, "_on_Timer_timeout")
|
|
_timer.set_wait_time(1)
|
|
_timer.set_one_shot(false) # Make sure it loops
|
|
_timer.start()
|
|
|
|
|
|
func _on_Timer_timeout():
|
|
if _thisloop:
|
|
get_node("World/RedLight").light_energy = 0
|
|
_thisloop = false
|
|
else:
|
|
get_node("World/RedLight").light_energy = 10
|
|
_thisloop = true
|