Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var questions = [ // structure: ["question",["choice1", "choice2", "choice3"], answer index]
- ["1+0",["1","2","3"],0],
- ["1+1",["1","2","3"],1],
- ["1+3",["1","4","3"],1],
- ["1+4",["1","5","3"],1],
- ["1+2",["1","2","3"],2]
- ]
- var cupPos = [
- [[4,119,233],[114,91,113]],
- [[13,127,242],[114,91,113]],
- [[32,137,243],[113,91,113]],
- [[57,147,238],[113,91,113]],
- [[76,153,233],[114,91,113]]
- ]
- var asked = new Array()
- function rand() {
- var position = [10,130,230]
- var random = Math.floor(Math.random() * position.length)
- diePos = random
- ldrdie.sourceComponent = diecomp
- }
- function questions() {
- return questions
- }
- function cupPos() {
- return cupPos
- }
- function ask() {
- randquestion = Math.floor(Math.random() * questions.length)
- if (asked.length != 0) {
- var i = asked.length - 1
- do {
- if (asked.indexOf(randquestion) != -1) {
- randquestion = Math.floor(Math.random() * questions.length)
- } else { break; }
- } while (i--)
- }
- question.text = questions[randquestion][0]
- asked.push(randquestion)
- c1.text = questions[randquestion][1][0]
- c2.text = questions[randquestion][1][1]
- c3.text = questions[randquestion][1][2]
- }
- function checkanswer() {
- question.opacity = 0
- c1.opacity = 0
- c2.opacity = 0
- c3.opacity = 0
- tmr5.running = true
- if (answer == questions[randquestion][2]) {
- correct.text = "Correct!"
- } else {
- wrong.text = "Wrong!"
- }
- }
- function func() {
- if (answer == questions[randquestion][2]) {
- if (level < 5) {
- level += 1
- leveltxt.text = "Level: " + level
- cupimg = "IMAGES FOR THESIS/for cups/lvl" + level + "CUP.png"
- dieimg = "IMAGES FOR THESIS/for dice/lvl" + level + "die.png"
- nextbtn.visible = false
- } else {
- exe2.opacity = 1
- tmr4.running = true
- }
- tmr5.running = false
- correct.text = ""
- askscreen.visible = false
- } else {
- ask()
- wrong.text = ""
- tmr5.running = false
- question.opacity = 1
- c1.opacity = 1
- c2.opacity = 1
- c3.opacity = 1
- }
- cup1.x = cupPos[level - 1][0][0]; cup1.y = cupPos[level - 1][1][0]
- cup2.x = cupPos[level - 1][0][1]; cup2.y = cupPos[level - 1][1][1]
- cup3.x = cupPos[level - 1][0][2]; cup3.y = cupPos[level - 1][1][2]
- rand()
- startbtn.visible = true
- startbtn.enabled = true
- }
Add Comment
Please, Sign In to add comment