Skip to main content
Participant
December 1, 2008
Question

CS3: Buttons that add to a score

  • December 1, 2008
  • 1 reply
  • 289 views
I'm trying to make an interactive quiz with a few key points: each answer has to add to a score, and the score has to be displayed at the end of the quiz in a dynamic text box.

Now... I've coded all the buttons and finished the animations, but I still need to set it up so each correct answer gives the player a point. How would I go about doing this, plus displaying it at the end?

P.S.
I might feel ambitious and try to have two different animations at the end, a "good" ending and a "bad" ending. How do I get the animation to go to a specific frame depending on the players score, depeding if it is above or below a certain number?
This topic has been closed for replies.

1 reply

Known Participant
December 1, 2008
just make a variable. global if you want.

private var score:int = 0

then just say
if (answer == "correct"){
score +=1
}

then on the end of the quiz when you click the last button.

have 2 animations ready on the timeline with on the beginning frame of each animaition a label.

"good" and a label "bad"

if( score > 5){
gotoAndPlay("good")
}else{
gotoAndPlay("bad")
}
their are various ways of doing this but I tried to make it as simple as I could...