Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 2    Views: 59

ceerup
Code is Art
Profile
Posts: 1033
Reg: Oct 10, 2011
New York City
16,380
08/01/12 12:43 PM (13 years ago)

Any way to make the Quiz timer go down instead of up

And when the timer goes down lets say you have 10 seconds to answer, if you fail to answer in the time limit it counts as wrong answer and goes to the next question? im on self hosted 2.0
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
08/02/12 03:05 AM (13 years ago)
Sure, some tweaks to the iOS / Android code is all you'll need. I don't have the code in front of me (it's 3:00 AM) but can offer some tidbits... --When a quiz button is tapped it triggers a "showNextQuestion" method. Not sure exactly what it's called, you'll see it when you scroll through the code. This is the method you want to trigger to advance to the next question. Like when your timer "runs out." --The timer is a simple mathematical equation. A routine runs every second and increments the timer. You could create a variable, like countdownLimit = 10 or something. With each iteration of the timerTick, you could minus one from this. When it reached 10, you could reset it then trigger the showNextQuestion routine. And, when a user taps an answer, you could reset it so each question allows 10 seconds. None of this is tough if you spend a bit looking through the showNextQuestion method and the timerTick method. Again, don't remember the method names without looking but I'm sure you can find them :-)
 
ceerup
Code is Art
Profile
Posts: 1033
Reg: Oct 10, 2011
New York City
16,380
like
08/02/12 09:27 AM (13 years ago)
Thank you so much David for the reply, im gonna look in the code for iOS and get to work and when i come up with something cool ill let ya know
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.