Weighted character selection
This commit is contained in:
@@ -25,7 +25,7 @@ func load_character_buttons():
|
||||
for character in MemberDatabase.character_data["members"]:
|
||||
#print("iterating through data")
|
||||
if character["isObtained"] ==true:
|
||||
print ("Created character:", character["name"])
|
||||
print ("Found character:", character["name"])
|
||||
var button = create_character_button(character)
|
||||
add_child(button)
|
||||
else:
|
||||
@@ -36,7 +36,7 @@ func load_character_buttons():
|
||||
func create_character_button(member: Dictionary) -> TextureButton:
|
||||
var button = TextureButton.new()
|
||||
#Loads the texture specified in the memberData sheet
|
||||
if member.has("texturePath"):
|
||||
if FileAccess.file_exists(member["texturePath"]):
|
||||
button.texture_normal = load(member["texturePath"])
|
||||
else:
|
||||
button.texture_normal = preload("res://Images/Members/Soldier.png") # Use a default texture if none is specified
|
||||
@@ -80,7 +80,7 @@ func _on_button_pressed(button: TextureButton, member: Dictionary):
|
||||
##print("Button pressed: ", button.name)
|
||||
|
||||
var selected_texture = button.texture_normal
|
||||
var texture = button.texture_normal
|
||||
#var texture = button.texture_normal
|
||||
# Logic to determine which target button to update (this can be based on user selection or some other logic)
|
||||
# For this example, we'll update the first available slot
|
||||
update_global_texture_singleton(selected_texture)
|
||||
|
||||
Reference in New Issue
Block a user