Hi!
This is my first post here, so be nice.. ;)
I am working on a quiz game and would like to know how to make my questions appear randomly.
Anynoe?
Label: corona android iphone ipad building error inmobi problem display screen View image tableView failed object physics touch button game lua config event listener |
Hi!
This is my first post here, so be nice.. ;)
I am working on a quiz game and would like to know how to make my questions appear randomly.
Anynoe?
you can do is like this, but i dont know if its good enough approach)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | local words = {"i", "am", "the", "beginner", "in", "corona", "sdk", "and", "this", "is", "an", "random", "words", "with", "timer", "example"} local wordTXT = display.newText("", 0,0, nil, 50) local function change_words() for i=1,math.random(1,#words),1 do wordTXT.text = words[i] wordTXT.x = math.random(70,300) wordTXT.y = math.random(70,300) end end timer.performWithDelay(500, change_words,0) |
Thats definetly random.. but not exactly what Im looking for (I think). Being a complete beginner I would not know how to implement this in my app. Any way I could contact you by mail so I dont have to spam the forum? Any help would be appreciated...
my skype: superfranky22
i'm glad to help
You would also need to add
math.randomseed(os.time())
to make it more random