squareeyes
09-09-2009, 07:00 PM
Hi there,
I'm making a gaming that has potentail points counting down and when you get the answer right it adds it to your score. For some reason it's not coming up with a total and just staying at 0.
Here is the code for the points system...
public function showGameScore() {
if (questionPoints != 0) {
scoreField.text = "Potential Points: "+questionPoints+"\t Your Score: "+gameScore;
} else {
scoreField.text = "Potential Points: ---\t Your Score: "+gameScore;
// start question points at max
questionPoints = 1000;
showGameScore();
}
Later followed by....
// update the clock
public function updateClock(event:TimerEvent) {
clock.gotoAndStop(event.target.currentCount+1);
questionPoints -= 25;
showGameScore();
if (event.target.currentCount == event.target.repeatCount) {
messageField = createText("Out of time! The correct answer was:",questionFormat,gameSprite,0,90,550);
finishQuestion();
Here is the clock it runs by....
clock = new Clock();
clock.x = 50;
clock.y = 120.5;
questionSprite.addChild(clock);
questionTimer = new Timer(1000,20);
questionTimer.addEventListener(TimerEvent.TIMER,up dateClock);
questionTimer.start();
:o
I'm making a gaming that has potentail points counting down and when you get the answer right it adds it to your score. For some reason it's not coming up with a total and just staying at 0.
Here is the code for the points system...
public function showGameScore() {
if (questionPoints != 0) {
scoreField.text = "Potential Points: "+questionPoints+"\t Your Score: "+gameScore;
} else {
scoreField.text = "Potential Points: ---\t Your Score: "+gameScore;
// start question points at max
questionPoints = 1000;
showGameScore();
}
Later followed by....
// update the clock
public function updateClock(event:TimerEvent) {
clock.gotoAndStop(event.target.currentCount+1);
questionPoints -= 25;
showGameScore();
if (event.target.currentCount == event.target.repeatCount) {
messageField = createText("Out of time! The correct answer was:",questionFormat,gameSprite,0,90,550);
finishQuestion();
Here is the clock it runs by....
clock = new Clock();
clock.x = 50;
clock.y = 120.5;
questionSprite.addChild(clock);
questionTimer = new Timer(1000,20);
questionTimer.addEventListener(TimerEvent.TIMER,up dateClock);
questionTimer.start();
:o