light_shadows.gd 697 B

1234567891011121314151617
  1. extends Node2D
  2. func _input(event):
  3. if event.is_action_pressed("toggle_directional_light"):
  4. $DirectionalLight2D.visible = not $DirectionalLight2D.visible
  5. if event.is_action_pressed("toggle_point_lights"):
  6. for point_light in get_tree().get_nodes_in_group("point_light"):
  7. point_light.visible = not point_light.visible
  8. if event.is_action_pressed("cycle_directional_light_shadows_quality"):
  9. $DirectionalLight2D.shadow_filter = wrapi($DirectionalLight2D.shadow_filter + 1, 0, 3)
  10. if event.is_action_pressed("cycle_point_light_shadows_quality"):
  11. for point_light in get_tree().get_nodes_in_group("point_light"):
  12. point_light.shadow_filter = wrapi(point_light.shadow_filter + 1, 0, 3)