Hi,
*EDITED FOR CLARITY*
If we can imagine positioning a row of objects across the screen.
The objects should transition to a certain x,y then transition on a timer after however many seconds.
My point is I have a single object, I want multiples of the object to transition to certain x,y co-ords .
I have a table of x,y values.
here is my code.
How would I spawn the object at the points defined in the x,y tables?
I can do it randomly. I am sure there is a simple solution, if I remove the math.random obviously, but what in its place?
[code]
local xTable = {150,200,250,300,350}
local yTable ={100,100,100,100,100}
function enemySpawn()
local sheet = graphics.newImageSheet( “images/enemyring.png”, { width=24, height=30, numFrames=10 } )
local enemy = display.newSprite( sheet, { name=“enemy”, start=1, count=9, time=1000 } )
xpoint = xTable[math.random(#xTable)]
ypoint = yTable[math.random(#yTable)]
enemy.x = xpoint
enemy.y = ypoint
enemy:play()
transition.from(enemy, { delay = 0, y = enemy.y -150,})
end
enemySpawnTimer = timer.performWithDelay(100, enemySpawn, 5)
[/code] [import]uid: 127675 topic_id: 32165 reply_id: 332165[/import]