mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-06 14:10:55 +03:00
Update most demos for Godot 4.0.beta10 (#782)
This commit is contained in:
21
2d/glow/beach_cave.gd
Normal file
21
2d/glow/beach_cave.gd
Normal file
@@ -0,0 +1,21 @@
|
||||
extends Node2D
|
||||
|
||||
const CAVE_LIMIT = 1000
|
||||
|
||||
var glow_map = preload("res://glow_map.webp")
|
||||
|
||||
@onready var cave = $Cave
|
||||
|
||||
func _unhandled_input(event):
|
||||
if event is InputEventMouseMotion and event.button_mask > 0:
|
||||
cave.position.x = clampf(cave.position.x + event.relative.x, -CAVE_LIMIT, 0)
|
||||
|
||||
if event.is_action_pressed("toggle_glow_map"):
|
||||
if $WorldEnvironment.environment.glow_map:
|
||||
$WorldEnvironment.environment.glow_map = null
|
||||
# Restore glow intensity to its default value
|
||||
$WorldEnvironment.environment.glow_intensity = 0.8
|
||||
else:
|
||||
$WorldEnvironment.environment.glow_map = glow_map
|
||||
# Increase glow intensity to compensate for the glow map darkening parts of the glow.
|
||||
$WorldEnvironment.environment.glow_intensity = 1.6
|
||||
Reference in New Issue
Block a user