mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-04 23:10: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).
29 lines
730 B
GDScript
29 lines
730 B
GDScript
extends Control
|
|
|
|
@onready var effect: OptionButton = $Effect
|
|
@onready var effects: Control = $Effects
|
|
@onready var picture: OptionButton = $Picture
|
|
@onready var pictures: Control = $Pictures
|
|
|
|
func _ready() -> void:
|
|
for c in pictures.get_children():
|
|
picture.add_item("PIC: " + String(c.get_name()))
|
|
for c in effects.get_children():
|
|
effect.add_item("FX: " + String(c.get_name()))
|
|
|
|
|
|
func _on_picture_item_selected(id: int) -> void:
|
|
for c in pictures.get_child_count():
|
|
if id == c:
|
|
pictures.get_child(c).show()
|
|
else:
|
|
pictures.get_child(c).hide()
|
|
|
|
|
|
func _on_effect_item_selected(id: int) -> void:
|
|
for c in effects.get_child_count():
|
|
if id == c:
|
|
effects.get_child(c).show()
|
|
else:
|
|
effects.get_child(c).hide()
|