So I wrote the following code to target an object with a random delay timer. The code works, however it will only select a single object at a time. What I need is to target an object at a random time (like the code I already wrote) but also potentially target multiple objects at the same time. To clarify, the self.targeting function is a function located within the scene. The self is the scene. This code is located in the enterScene function of my storyboard scene.
function targetingRepeater() self.targeting({objTable = targetTable,}) timer.performWithDelay( math.random( 1000, 8000 ), function() targetingRepeater() end, 1 ) end timer.performWithDelay( math.random( 1000, 8000 ), function() targetingRepeater() end, 1 )
Does anyone have any idea about how to do that without the targeting function increasing out of control? Ideally I would like 1-5 objects to be targeted at the same time, but I’m not sure how to do that without the targeting repeater function to spiral out of control targeting objects at an exponential rate. Help is MUCH appreciated.