mtd/Scenes/Menus/CharacterSelect/charselect.gd

20 lines
516 B
GDScript3
Raw Normal View History

2024-02-22 06:22:22 +11:00
class_name HeroSelector extends Control
2023-12-09 01:09:12 +11:00
2024-02-22 06:22:22 +11:00
signal hero_selected(hero_class: int)
2023-12-09 01:09:12 +11:00
@export var hero_card_scene: PackedScene
@export var hbox: HBoxContainer
func _ready() -> void:
2024-02-22 06:22:22 +11:00
for hero: HeroClass in Data.characters:
var card: Control = hero_card_scene.instantiate()
2023-12-09 01:09:12 +11:00
card.set_hero(hero)
2024-03-23 22:36:19 +11:00
card.pressed.connect(func(x: int) -> void: hero_selected.emit(x))
card.button_mouse_entered.connect(_on_button_mouse_entered)
2023-12-09 01:09:12 +11:00
hbox.add_child(card)
2024-02-22 06:22:22 +11:00
func _on_button_mouse_entered() -> void:
$AudioStreamPlayer.play()