mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-06 16:00:08 +01:00
This leads to code that is easier to understand and runs faster thanks to GDScript's typed instructions. The untyped declaration warning is now enabled on all projects where type hints were added. All projects currently run without any untyped declration warnings. Dodge the Creeps and Squash the Creeps demos intentionally don't use type hints to match the documentation, where type hints haven't been adopted yet (given its beginner focus).
18 lines
717 B
GDScript
18 lines
717 B
GDScript
extends Node2D
|
|
|
|
|
|
func _input(event: InputEvent) -> void:
|
|
if event.is_action_pressed("toggle_directional_light"):
|
|
$DirectionalLight2D.visible = not $DirectionalLight2D.visible
|
|
|
|
if event.is_action_pressed("toggle_point_lights"):
|
|
for point_light in get_tree().get_nodes_in_group("point_light"):
|
|
point_light.visible = not point_light.visible
|
|
|
|
if event.is_action_pressed("cycle_directional_light_shadows_quality"):
|
|
$DirectionalLight2D.shadow_filter = wrapi($DirectionalLight2D.shadow_filter + 1, 0, 3)
|
|
|
|
if event.is_action_pressed("cycle_point_light_shadows_quality"):
|
|
for point_light in get_tree().get_nodes_in_group("point_light"):
|
|
point_light.shadow_filter = wrapi(point_light.shadow_filter + 1, 0, 3)
|