0

This is my code, which changes by frame, I need to do a scoring system, but when I used the following code to add a score it works fine for the first 2 frames then doubles and by the end it's like 229. Thank you for any help.

Score;

var score = 0;

function scoreIt(); {
    score += 1;
}

Frame by frame;

this.stop();

this.ans1.addEventListener("click", fl_MouseClickHandler.bind(this));

function fl_MouseClickHandler() {
    this.rocket2.play();
    this.rocket1.stop();
    this.rocket3.stop();
    this.next.mouseEnabled = true;
    this.ans2.mouseEnabled = false;
    this.ans3.mouseEnabled = false;

    this.ans2.answer2.color = ("#00ff00");
    this.ans1.answer1.color = ("#cd0000");
    this.ans3.answer3.color = ("#cd0000");
}

this.ans2.addEventListener("click", f2_MouseClickHandler.bind(this));

function f2_MouseClickHandler() {
    this.rocket1.play();
    this.rocket2.stop();
    this.rocket3.stop();
    this.next.mouseEnabled = true;
    this.ans1.mouseEnabled = false;
    this.ans3.mouseEnabled = false;

    this.ans2.answer2.color = ("#00ff00");
    this.ans1.answer1.color = ("#cd0000");
    this.ans3.answer3.color = ("#cd0000");

    scoreIt();
}

this.ans3.addEventListener("click", f3_MouseClickHandler.bind(this));

function f3_MouseClickHandler() {
    this.rocket3.play();
    this.rocket2.stop();
    this.rocket1.stop();
    this.next.mouseEnabled = true;
    this.ans2.mouseEnabled = false;
    this.ans1.mouseEnabled = false;

    this.ans2.answer2.color = ("#00ff00");
    this.ans1.answer1.color = ("#cd0000");
    this.ans3.answer3.color = ("#cd0000");
}

Edited by happygeek: moved

1
Contributor
0
Replies
17
Views
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.