Any ideas? I’d post what I had so far. I thought it’d be confusing, maybe it could help. I’ve just been at this for days now and I’m not sure how to make it work.
I set the question and answers in parse.com. I made a cloud code that randomly selects one of the question with the multiple choices and returns them the Android phone. I used the mod_parse.lua module by develephant. Here’s what I have:
local function onRun( event ) if not event.error then print( event.response.result[1].question )--Cloud code randomly pulls the question print( event.response.result[1].choiceA ) print( event.response.result[1].choiceB ) print( event.response.result[1].choiceC ) end end parse:run( "getRandomQuestion", functionParams, onRun )
If it’s too complicated, you don’t have to worry about displaying a countdown, I can do it myself later. I just need help with how to set up the timer. What I was trying to do:
local function timerListener10( event ) local function onRun( event ) if not event.error then print( event.response.result[1].question )--Cloud code randomly pulls the question print( event.response.result[1].choiceA ) print( event.response.result[1].choiceB ) print( event.response.result[1].choiceC ) end end parse:run( "getRandomQuestion", functionParams, onRun ) end local timer1 = timer.performWithDelay( 10000, timerListener10, 0 )
Since there will be a total of 10 seconds in the game, what I was trying to do was use something like “if( timer1 == 3000 ) then local function onRun( event )”. Basically after 3 seconds, display the question with multiple choice, leaving 7 seconds left on the timer. And then again, use another check for those 7 seconds, when the countdown now reaches 7000 milliseconds or 3 seconds left, to display the buttons. And then when the timer1 == 10000 or after the whole 7 seconds, to go back to the timer1 == 3000 or to loop and do the same thing over again. I tried putting that in my code but it was not working. Any help would be great. Thanks.