New to this and i need help!

Ok so i am currently creating an app that display a picture everyday until a set date i am using this code for each image to display: [code]
_H = display.contentHeight;
_W = display.contentWidth;
mRand = math.random;

local function spawnMint()
local Mint = display.newImageRect(“thumbnail.jpg”, 80, 80);
Mint:setReferencePoint(display.CenterReferencePoint);
Mint.x = mRand(50, _W-50); Mint.y = mRand(50, _H-50);
end

tmr = timer.performWithDelay(100, spawnMint, 1);

[code]

But the problem im having is that the images are over laping each other and i want to make it so that it doesnt do that. i have done research on how to fix this but nothing has come up. If you could help me i would appreciate it, thank you. [import]uid: 69054 topic_id: 18621 reply_id: 318621[/import]

It would seem that the pictures are overlapping because you are never removing the previous pictures.

You will need to remove the image or animate it away before you add a new one, if you do not want to see the previous image. And you’ll need to declare the image variable outside of the function.

[code]
_H = display.contentHeight;
_W = display.contentWidth;
mRand = math.random;

local Mint
local function spawnMint()
if Mint then
display.remove(Mint)
end
Mint = display.newImageRect(“thumbnail.jpg”, 80, 80);
Mint:setReferencePoint(display.CenterReferencePoint);
Mint.x = mRand(50, _W-50); Mint.y = mRand(50, _H-50);
end

tmr = timer.performWithDelay(100, spawnMint, 1);

[/code] [import]uid: 94868 topic_id: 18621 reply_id: 71499[/import]

Oh ok thank you. [import]uid: 69054 topic_id: 18621 reply_id: 71519[/import]