Team Screen propagates images
This commit is contained in:
25
TeamSelection.gd
Normal file
25
TeamSelection.gd
Normal file
@@ -0,0 +1,25 @@
|
||||
extends GridContainer
|
||||
|
||||
# Signal to send texture data back to the main scene
|
||||
signal texture_selected(texture : AtlasTexture)
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
# Iterate over all children of the GridContainer
|
||||
for button in get_children():
|
||||
# Check if the child is a TextureButton
|
||||
if button is TextureButton:
|
||||
# Connect the pressed signal of the TextureButton to the handler function
|
||||
button.connect("pressed", Callable(self, "_on_TextureButton_pressed").bind(button))
|
||||
|
||||
# Handler function for the pressed signal
|
||||
func _on_TextureButton_pressed(button):
|
||||
# Print the name of the button
|
||||
print("Button pressed: ", button.name)
|
||||
|
||||
#Texture Variable
|
||||
var texture : AtlasTexture = button.texture_normal
|
||||
Global.selected_texture = texture
|
||||
get_tree().change_scene_to_file("res://User Interface/UserInterface.tscn")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user