Hello again))
Is there any way to ensure that math.random function will always get different numbers?
i have this set up, but images often repeated, i’d like them to be different every time and not match
[lua]math.randomseed( os.time() )
local shipTable = {
{img = “rocketShip1.png”, color = “green”},
{img = “rocketShip2.png”, color = “blue”},
{img = “rocketShip3.png”, color = “red”}
}
maxImages = 3
t = {}
for many=1, maxImages do
local i = math.random(#shipTable)
t[many] = display.newImage(shipTable[i].img)
t[many].color = shipTable[i].color
t[many].x = math.random(50,300)
t[many].y = math.random(50,300)
local function onTouch(event)
print(image.color)
end
t[many]:addEventListener(“touch”, onTouch)
end[/lua]
any help is appreciated [import]uid: 16142 topic_id: 17967 reply_id: 317967[/import]
[import]uid: 13097 topic_id: 17967 reply_id: 68619[/import]
Damnit!
[import]uid: 13097 topic_id: 17967 reply_id: 68629[/import]