Hello,
I have an array with variables that load image textures. I am using the randomize() and shuffle() methods to update/change the texture on some objects. then I am using an emit_signal to pass along the shuffled version of the array to other scripts.
I found that the passed signal argument/variable is a [streamtexture????] I don't know how to use this in my other script/functions. So I want to convert the data in the Shape_library array to a "strings" that have the new index positions.
I thought about creating another array(shape_library_string) that would mimic it.. I could not figure out a way to do this or find another better way??
I found a work around but involves a lot of "if " statements and i was thinking there was more efficient method?
here is the code i am working on:
func _on_Area_area_entered(area):
var circle_texture = load("res://text_img/shape_codes/circle_graphic.png")
var triangle_texture = load("res://text_img/shape_codes/triangle_graphic.png")
var square_texture = load("res://text_img/shape_codes/square_graphic.png")
var shape_library = [circle_texture,triangle_texture,square_texture]
var shape_library_string = ["circle","triangle","square"]
randomize()
shape_library.shuffle()
$card_parent/card_03.get_surface_material(0).albedo_texture = shape_library[0]
$card_parent/card_01.get_surface_material(0).albedo_texture = shape_library[1]
$card_parent/card_04.get_surface_material(0).albedo_texture = shape_library[2]
emit_signal("shape_combination",shape_library_string)
I tried shuffling both arrays at the same time but both are shuffled differently