all groups > flash actionscript > july 2004 >
You're in the

flash actionscript

group:

putting SCORES in games



putting SCORES in games Leao16
7/28/2004 9:28:40 PM
flash actionscript: Hi I'm making a very simple educational game at the mo, with a series of
multiple choice questions about health issues in Nigeria
Please can you tell me how to add a simple scoring system to it?
i.e. a player gets 10 points for getting a question right 1st time and 5 if he
makes a mistake + then chooses the right answer

I have the .swf and .fla files uploaded
http://leoearle.tripod.com/cafod/index.htm
its only a draft at the mo (the game's about 70% complete)
I'd be very grateful for any help
Leo
Re: putting SCORES in games mandingo
7/28/2004 11:26:33 PM
One way to handle it would be to have an Object associated with each question...

Then when the user clicks on a choice, you can increment the attempts ... if
the attempts == 1 give 10 points if attempts == 2, then they get 5 and if
attempts == 3 they get none.

question1 = new Object();
question1.attempts = 0;
question1.score = 0;

then on select of an option

this.onRelease = function(){
question1.attempts++;
// and whatever else you had
if(correctAnswer == true){
switch(question1.attempts){
case 1:
question1.score = 10;
break;
case 2:
question1.score = 5;
break;
default:
question1.score = 0;
}
}
}

Something along those lines could do it... an idea anyway...
hope that helps,
cheers.

By the way, at the end, you can check the score by
numberOfQues = 10;
for(var k =0, k<numberOfQues;k++){
totalScore += _root["question"+(k+1)].score;
}


AddThis Social Bookmark Button