|
Back to the How To index
About SC Simple Quiz
|
. |
| This is what we have:
Now we can put in some scripts to make the quiz work.
To edit the script of a button, we can select it with the pointer tool, and choose Script from the Edit popup on the Property Inspector,
or go through the Object Info dialog, via the Edit menu.
on mouseUp WrongAnswer end mouseUpIn the Button with the right answer: on mouseUp RightAnswer end mouseUpnow if we click on a button, we get a dialog telling us SuperCard cannot understand WrongAnswer (or RightAnswer) So we need to add scripts to handle this. A good place for thes scripts is the background shared by all the cards. No matter how many question (cards) we have
they will all share the same background.
on wrongAnswer answer "Wrong! Try again." end wrongAnswerNow try clicking on a wrong answer button: Here is a script for the right answer: on rightAnswer answer "Right, Well Done." end rightAnswerWe want to go to the next question(card) so we can do this: on rightAnswer answer "Right, Well Done." go next card end rightAnswerThe problem with this is that it dosen't let us stop, when we get to the last card, we go back to the first, so: on rightAnswer answer "Right, Well Done." --comments start with 2 - in superCard -- these are ignored when the script runs, they are not red in SC --work out if it is the last card if not go to the next card --if it is the last question offer to quit or start again if the number of cards > the number of this cd then go next else answer "Game Over." with "Quit" or "Start Again" if it is "quit" then quit else go cd 1 end rightAnswer Beleve it or not we have a functioning quiz the next page lets you know how to set it up.next. |
| PREVIOUS | NEXT |