armstr38 Posted April 5, 2018 Share Posted April 5, 2018 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"); } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.