In Factory component manual There is:
-- spawner.script
self.spawned_coins = {}
and
-- coin.script
-- Delete all spawned coins.
for _, coin_id in ipairs(self.spawned_coins) do
go.delete(coin_id)
end
That is the manual shows self.spawned_coins defined in one script and used in another. This does not work for me. I tried doing this in the Side scroller tutorial.
I put it in the init of factory.script and printed in init of star.script and got null.
I am doing to learn and not for anything specific.
Please can someone explain.
Edit: In the side scroller tutorial, I was trying to see if I could get the stars to stop when p.x ==200 (say) and go back the other way; just for fun! Then I discovered that all stars use the same instance (parameter values) of the script. So I need to find a way to identify individual stars…