fixed some bugs The Typening caused
This commit is contained in:
19
Scenes/Menus/CharacterSelect/charselect.gd
Normal file
19
Scenes/Menus/CharacterSelect/charselect.gd
Normal file
@ -0,0 +1,19 @@
|
||||
class_name HeroSelector extends Control
|
||||
|
||||
signal hero_selected(hero_class: int)
|
||||
|
||||
@export var hero_card_scene: PackedScene
|
||||
@export var hbox: HBoxContainer
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
for hero: HeroClass in Data.characters:
|
||||
var card: Control = hero_card_scene.instantiate()
|
||||
card.set_hero(hero)
|
||||
card.pressed.connect(func(x: int) -> void: hero_selected.emit(x))
|
||||
card.button_mouse_entered.connect(_on_button_mouse_entered)
|
||||
hbox.add_child(card)
|
||||
|
||||
|
||||
func _on_button_mouse_entered() -> void:
|
||||
$AudioStreamPlayer.play()
|
49
Scenes/Menus/CharacterSelect/charselect.tscn
Normal file
49
Scenes/Menus/CharacterSelect/charselect.tscn
Normal file
@ -0,0 +1,49 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://dqqitmhu66a7d"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scenes/Menus/CharacterSelect/charselect.gd" id="1_h2h26"]
|
||||
[ext_resource type="PackedScene" uid="uid://bnsf2degj5tio" path="res://Scenes/UI/hero_card.tscn" id="1_v2mfo"]
|
||||
[ext_resource type="AudioStream" uid="uid://dknygn5eyuhxt" path="res://shot1.wav" id="3_o88ca"]
|
||||
|
||||
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_ehpk7"]
|
||||
random_pitch = 1.1
|
||||
streams_count = 1
|
||||
stream_0/stream = ExtResource("3_o88ca")
|
||||
stream_0/weight = 1.0
|
||||
|
||||
[node name="Control" type="Control" node_paths=PackedStringArray("hbox")]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
script = ExtResource("1_h2h26")
|
||||
hero_card_scene = ExtResource("1_v2mfo")
|
||||
hbox = NodePath("CenterContainer/VBoxContainer/HBoxContainer")
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="CenterContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Choose your hero"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="CenterContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||
stream = SubResource("AudioStreamRandomizer_ehpk7")
|
||||
bus = &"SFX"
|
Reference in New Issue
Block a user