pause.gd 1.2 KB

123456789101112131415161718192021222324252627
  1. extends Label
  2. func _input(event):
  3. if event.is_action_pressed("toggle_pause"):
  4. get_tree().paused = not get_tree().paused
  5. if event.is_action_pressed("toggle_trails"):
  6. # Particles disappear if trail type is changed while paused.
  7. # Prevent changing particle type while paused to avoid confusion.
  8. for particles in get_tree().get_nodes_in_group("trailable_particles"):
  9. particles.trail_enabled = not particles.trail_enabled
  10. if event.is_action_pressed("increase_trail_length"):
  11. # Particles disappear if trail type is changed while paused.
  12. # Prevent changing particle type while paused to avoid confusion.
  13. for particles in get_tree().get_nodes_in_group("trailable_particles"):
  14. particles.trail_lifetime = clampf(particles.trail_lifetime + 0.05, 0.1, 1.0)
  15. if event.is_action_pressed("decrease_trail_length"):
  16. # Particles disappear if trail type is changed while paused.
  17. # Prevent changing particle type while paused to avoid confusion.
  18. for particles in get_tree().get_nodes_in_group("trailable_particles"):
  19. particles.trail_lifetime = clampf(particles.trail_lifetime - 0.05, 0.1, 1.0)
  20. if event.is_action_pressed("toggle_glow"):
  21. get_node("../..").environment.glow_enabled = not get_node("../..").environment.glow_enabled