Jump to content

Help with scoring using animate cc


armstr38
 Share

Recommended Posts

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;


 
  1. var score = 0;
  2.  
  3. function scoreIt(); {
  4. score += 1;
  5. }

Frame by frame;

  1. this.stop();
  2.  
  3. this.ans1.addEventListener("click", fl_MouseClickHandler.bind(this));
  4.  
  5. function fl_MouseClickHandler() {
  6. this.rocket2.play();
  7. this.rocket1.stop();
  8. this.rocket3.stop();
  9. this.next.mouseEnabled = true;
  10. this.ans2.mouseEnabled = false;
  11. this.ans3.mouseEnabled = false;
  12.  
  13. this.ans2.answer2.color = ("#00ff00");
  14. this.ans1.answer1.color = ("#cd0000");
  15. this.ans3.answer3.color = ("#cd0000");
  16. }
  17.  
  18. this.ans2.addEventListener("click", f2_MouseClickHandler.bind(this));
  19.  
  20. function f2_MouseClickHandler() {
  21. this.rocket1.play();
  22. this.rocket2.stop();
  23. this.rocket3.stop();
  24. this.next.mouseEnabled = true;
  25. this.ans1.mouseEnabled = false;
  26. this.ans3.mouseEnabled = false;
  27.  
  28. this.ans2.answer2.color = ("#00ff00");
  29. this.ans1.answer1.color = ("#cd0000");
  30. this.ans3.answer3.color = ("#cd0000");
  31.  
  32. scoreIt();
  33. }
  34.  
  35. this.ans3.addEventListener("click", f3_MouseClickHandler.bind(this));
  36.  
  37. function f3_MouseClickHandler() {
  38. this.rocket3.play();
  39. this.rocket2.stop();
  40. this.rocket1.stop();
  41. this.next.mouseEnabled = true;
  42. this.ans2.mouseEnabled = false;
  43. this.ans1.mouseEnabled = false;
  44.  
  45. this.ans2.answer2.color = ("#00ff00");
  46. this.ans1.answer1.color = ("#cd0000");
  47. this.ans3.answer3.color = ("#cd0000");
  48. }
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...