hmmm, I see.
I will try to simplify what I did so far, cuz I divide things in too many scripts that is hard for me to paste all here and to make sense.
So,
I have 3 factory objects, named:
factory_circle, factory_rectangle, factory_triangle, with go prototypes associated with them.
Then I have a table with names same as a factory names:
local shapesTable = {'factory_circle', 'factory_rectangle', 'factory_triangle'}
after that I am spinning random number, to pick some of available shapes
local shape = math.random(#shapesTable)
require "main.moduleScript" ---> module script to collect name of the shape and play sound function
--- spawn first shape
shape1 = factory.create("#"..shapesTable[shape], somePosition)
mShape1 = shapesTable[shape] --->stored in module script for sound function
table.remove(shapesTable, shape)
Sound1() ---> from module script
--- spawn second shape
--- random math for the rest of the shape in tables and so on
then I have a module script where I want to store spawned names in a variable cuz they will activate some sound that has again, same name as a factory
--moduleScript
mShape1 = nil
mShape2 = nil
mShape3 = nil
function Sound1()
sound.play("main:/go_soundController#".. tostring(mShape1), nil, nil)
end
--- and so on, another functions for other shapes
and that’s why I need exact names of objects during collision with touch, cuz this is how I orginize things before to recognize each other.