beach_cave.gd 736 B

123456789101112131415161718192021
  1. extends Node2D
  2. const CAVE_LIMIT = 1000
  3. var glow_map = preload("res://glow_map.webp")
  4. @onready var cave = $Cave
  5. func _unhandled_input(event):
  6. if event is InputEventMouseMotion and event.button_mask > 0:
  7. cave.position.x = clampf(cave.position.x + event.relative.x, -CAVE_LIMIT, 0)
  8. if event.is_action_pressed("toggle_glow_map"):
  9. if $WorldEnvironment.environment.glow_map:
  10. $WorldEnvironment.environment.glow_map = null
  11. # Restore glow intensity to its default value
  12. $WorldEnvironment.environment.glow_intensity = 0.8
  13. else:
  14. $WorldEnvironment.environment.glow_map = glow_map
  15. # Increase glow intensity to compensate for the glow map darkening parts of the glow.
  16. $WorldEnvironment.environment.glow_intensity = 1.6