blinker.gd 461 B

123456789101112131415161718192021222324
  1. extends MeshInstance
  2. var on = true
  3. export var period = 1
  4. # Declare member variables here. Examples:
  5. # var a = 2
  6. # var b = "text"
  7. # Called when the node enters the scene tree for the first time.
  8. func _ready():
  9. var timer = Timer.new()
  10. timer.wait_time = period
  11. add_child(timer)
  12. timer.start()
  13. timer.connect("timeout",self,"toggle")
  14. func toggle():
  15. on = not on
  16. update()
  17. func update():
  18. get_surface_material(0).emission_enabled = on
  19. $OmniLight.visible= on