Hello.
I am having a problem spawning objects on random coordinates.
The objects are spawning alright, but they overlap when (xpoint,ypoint) get the same value as before and i don’t know how to fix it.
[lua]local xTable = {50,108,158,214,266,57,108,160,211,264,54,108,162,214,267,53,107,162,215,267}
local yTable = {288,287,287,288,288,341,341,342,342,342,392,392,395,395,396,439,440,443,443,442}
local function spawnMole()
local xpoint = xTable[math.random(#xTable)]
local ypoint = yTable[math.random(#yTable)]
local mole = display.newImageRect(“mole-5-coloring-page[1].jpg”,49, 45);
mole.x = xpoint;
mole.y = ypoint;
end
tmr = timer.performWithDelay(500, spawnMole, 999);[/lua]
Help would be much appreciated. [import]uid: 30816 topic_id: 29058 reply_id: 329058[/import]