Quiz

 

The purpose is to make a Quiz and its results. We'll use scripts.
A variable 'points' is init to 0, and everytime an answer has been clicked, 'points' will rise or get down.
The total amount is evaluated after last answer.
I suppose you know well how to create objects, thus I will not insist on.

⇒ animation ⇐

At first, Download sounds. 

Creating Objects

1 - Set up size of the movie 640x480 (background color #000042).
Frame Rate 35
In Content, import applaus.wav and boo.wav

2 - Create static text : Quiz (menu Insert / Text)
Font : Verdana Size : 80 centered in scene color #FFCC00.

3 - Right now creete a button named Button as shown :

   

Set colors at your convenience.

4 -First question and its answers :

Static text : Question 1
Font : Verdana Size : 22 color #FFCC00

Then 4 associated buttons for the answers. For instance, first one :

Explanations : Text first, then a puce convert into sprite with effect.
Settings for 4 text ( W = 150 H = 20 ) and radiobuttons ( W = 15 H = 15 )

ButtonXYtext
Button1_1245145Reponse 1-1
Button1_2245190Reponse 1-2
Button1_3245235Reponse 1-3
Button1_0245280Ne sais pas
radiobuttonXY
puce1_1225145
puce1_2225190
puce1_3225235
puce1_0225280

Convert each set text+puce in button (Target toggled), then for each state Over convert puce into Sprite, then set an effect Transform over 20 frames

5 - For question 2, do the same replacing 1_ with 2_, and 1- with 2-

6 - Enter static text : Total (same X,Y as question 1)

7 - Enter dynamic text msg_result (variable : txtdyn)

   

8 - Enter dynamic text msg_points (variable : txtdyn1)

   

9 - At last, create a button Retour as you did at the beginning :

Creating Effect

In Timeline, frame 9, for Total : Add Effect / Appear into Position / Come in - Appearance sur 20 frames.

Scripts

In Outline, select Scene_1. Enter script :

In Outline, select Button. Enter script :

on (press) { nextFrameAndPlay(); }

Now, we set up points
In Outline, select Button1_1. Enter script :

on (release) {
/* very bad answer = remove 10 points */
   points -= 10;
   nextFrameAndPlay();
}

In Outline, select Button1_2. Enter script :

on (release) {
   /* good answer = give 10 points */
   points += 10;
   nextFrameAndPlay();
}

In Outline, select Button1_3. Enter script :

on (release) {
   /* bad answer = remove 5 points */
   points -= 5;
   nextFrameAndPlay();
}

In Outline, select Button1_0. Enter script :

on (release) {
   /* Don't know = remove 1 point */
   points--;
   nextFrameAndPlay();
}

In Outline, select Button2_1. Enter script :

on (release) {
   /* good answer = give 10 points */
   points += 10;
   nextFrameAndPlay();
}

In Outline, select Button2_2. Enter script :

on (release) {
   /* bad answer = remove 5 points */
   points -= 5;
   nextFrameAndPlay();
}

In Outline, select Button2_3. Enter script :

on (release) {
/* very bad answer = remove 10 points */
   points -= 10;
   nextFrameAndPlay();
}

In Outline, select Button2_0. Enter script :

on (release) {
   /* Don't know = remove 1 point */
   points--;
   nextFrameAndPlay();
}

In Outline, select Retour. Enter script :

on (press) { gotoSceneAndPlay("<current scene>",1); }

Timeline

Set up Place at right places showed underneath ( Stop are already in scripts) :

Test. Now, It's up to you.

 


Si vous aimez le site

 

Select a language if you need :


Page chargée en 0.004 sec.

Dernière Modification : Mer 25 Janvier 2017 8:56
Copyright © 1999-2017 Jean-Paul Molina Tous droits réservés.

to Google