Help computing scores on Trivia game

I need to compute scores and would also like to notify users on their progress
There are 5 questions , 20pts each = 100pts;
I built two arrays (rightAnswers will compute scores and completeAnswers will give them their progress :
var rightAnswers:Array = new Array(next1_mc, next2_mc, next3_mc, next4_mc, next5_mc);
var completeAnswers:Array = new Array(submit_btn, submit2_btn, submit3_btn, submit4_btn, submit5_btn);
I know I need to set them both at 0 something like:
for (var i:int=0; i<=4;i++)
so I think the  function for score is
function computeScore() {
     for(var i:int = 0; i < 4; i++) {
    var rightAnswer:int = rightAnswers[0] + rightAnswers[1] + rightAnswers[2] + rightAnswers[3]+ rightAnswers[4];
   scorefinal_txt.text="Your score is " + int((rightAnswers[0] + rightAnswers[1] + rightAnswers[2] + rightAnswers[3]+ rightAnswers[4]) * 20);
so I think the function for the FIRST progress_txt (twhich their will be 5 for each question completed)  <<clueless on this one
function computeProgress() {
            for(var i:int = 0; i < 4; i++) {
            var completeAnswers:Array = new Array(submit_btn, submit2_btn, submit3_btn, submit4_btn, submit5_btn);
            progress_txt.text = "You've completed " +int(( correctAnswers[0] + correctAnswers[1] + correctAnswers[2]  + correctAnswers[3]  +
            correctAnswers[4]) - -i) + " questions out of 5";
can someone push me in the right direction or a site to help research

if you just want to track score and current question, you don't need arrays.  just use a variable to store their score (initialized at 0) and a variable to store the current question (initialized at 1 when the question is displayed).
after they answer a question either increment the score variable or not.
when they advance to the next question, increment the current question variable.

Similar Messages

  • Need a little help with a trivia game

    Hey guys I was wondering if I could get some help. I'm taking a class at school for java programming and its my first class. And I have to do a final assignment, which is to make a java trivia game. I have all the parts coded already pretty sure. Now be forewarned that I'm not "that" great at programming.
    But the part that I'm stuck on and cant really get any help on is this: For the game I need to have a file with all the questions and answers, which is created already and works. The file writer has the question, choice 1, choice 2, choice 3, choice 4 and the answer written to it, in that order. We needed to implement a GUI and I coded that as a message label on top where the question will go, in the middle 4 radio buttons where the choices to the answer will go and on the bottom a next question, ok and quit button.
    My question is this: How do I pull the information from the file that was written to appear in the GUI, such as the question and the choices for the answers for the question? ANY and ALL help would be appreciated

    Read the information using a BufferedReader wrapped around a FileReader. Change your GUI using setText on the component you want to display the text.
    Edit: An example that does both things
    import java.io.*;
    import javax.swing.*;
    public class FileAndSwing {
       public static void main(String[] args) throws Exception {
          BufferedReader reader = new BufferedReader(
                new FileReader("FileAndSwing.java"));
          StringBuilder builder = new StringBuilder();
          for ( String line = null; (line = reader.readLine()) != null; ) {
             builder.append(line).append("\n");
          JFrame frame = new JFrame("FileAndSwing.java");
          frame.setSize(500, 500);
          JTextArea field = new JTextArea();
          frame.add(field);
          field.setText(builder.toString());
          frame.setVisible(true);
    }This is also kind of a Quine :-).
    Edited by: endasil on 15-Dec-2009 4:00 PM

  • How to delete the saved score in a game downloaded from app store for my macbook and restart the game from the beginning ? please help

    HOW to delete the saved score in a game downloaded from the app store to restart the game from the begining with fresh scores.
    i am unable to do so. please help

    In system preferences, create a new account again, using the short name of the "deleted" account. You may be prompted to re-use the old home folder. Log out and log in to test it worked. Then log in as your new admin, and do the delete process again. Don't choose to securely delete this time - just a regular delete.
    When you have time to spare, go to Disk Utility, and use the Erase tab to securely erase free space on the drive. This will accomplish the same thing that your originally tried to do. Use the fastest method - anything more secure is a waste of time. You may need to run it overnight - it can take several hours.
    Matt

  • Scoring in a trivia game

    I'm putting together a flash trivia game. I want the score to
    be revealed only after all the questions have been answered.
    Something like this:
    1-5 right, try again
    10+ right, good job
    15+ you're getting better
    20+ you're a master
    So, I need some script to remember the score, and keep it
    hidden, and count the right answers and reveal them at the end.
    Can someone help me with this?
    I'm kinda new to action scripting

    To be able to play existing sounds fragments and play generated tones you can use the Mobile Media API (MMAPI). Check whether your target JVM implementation supports MMAPI.
    To be able to play a certain tone you could use something like this:
    (check the API specification of the 'javax.microedition.media' package)
    Manager.playTone(int note, int duration, int volume)
    That should do the trick.
    Jasper

  • Computer lags when playing games.

    Hi folks.
    I have a problem with my computer, several in fact.
    1. Computer lags when playing games(Battlefield/Desert Combat) even on lowest video settings, especially when there is a lot of action.  
    2. When I open "My Computer" it searches for 3-5 minutes before files appear, but when opening "my documents" for example, it opens it without any delay.
    3. Startup is fast but when logging on, computer hangs for a couple of minutes, before completing log on.
    Is there anyone who can help me out???
      plz help

    Hi NovJoe, thanks for the reply. Nice rig by the way.
    Ive disabled all programs except essential windows programs in Task Manager, it didnt help.
    Ive changed to new drivers, uninstalled them, changed to older drivers, tried 7 different drivers.
    VGA card is running cold, CPU is on 40 cel. under full load, RAM is cool as well. PSU isnt running hot either.
    Even checked the chipset, and thats cool also. I switched cabinets and that helped a bit(different PSU).
    Now I only have problems with the lagging when playing.
    So now Ive ordered a new PSU and mobo (MSI 865PE NEO2-V) I have a feeling its the VGA slot thats not giving me enough power to the VGA card.
    And the new PSU is just so cool I had to have it. When Ive complete the build Ill post pics on the forum.
    Anyways, Ill let you guys know if this will solve my problem.

  • Trivia Game: Error while testing CS3 app in CS4

    I have been attempting to test an exercise file for a Trivia
    Game written in AS3 using the Flash CS3 IDE.
    Unfotunately I have been receiving two errors each time its
    run while using Flash Professional CS4.:
    <ol>
    <li><strong> 1023: Incompatible override.
    </strong></li>
    <li><strong> 1021: Duplicate function
    definition.</strong></li>
    </ol>
    each of these errors occur on the same line:
    <ul>
    <li> <strong>public function showScore()
    {</strong></li>
    </ul>
    Can anyone help? The code and every

    It appears that showScore is some sort of reserved word in
    CS4 or one of the CS4 libraries. Just change every showScore in the
    code to something else like showGameScore and it should
    work.

  • Music trivia game error message

    i'm having problems accessing my music trivia game. it worked when i got the ipod last week, but now that i've used it a bit, whenever i go to play my music trivia, "no songs found, error" appears on my screen. does anyone know why? is there some way i can fix it? i have only deleted a couple of songs and added a whole album (18 songs) but that's the extent of the changes i've made with the nano. any help would be appreciated
    thanks
    PC   Windows XP   Sony

    If I reset the iPod, that means all the songs will be deleted too, right? I'm still a little unclear with all these 5 R's thrown into the mix every which way!
    Thanks

  • Help Needed to Write Nim Game

    I need help in writing the Nim game. I have the program written already for the user to select if they want to go first or the computer and how many stones the user wants to start with. The problem I am having is writing a loop that recognizes which player is to go first and executes the play of taking stones. Any help would be appreciated.

    Perhaps there could be a boolean firstPlayerMove. Then, when the loop starts, if that is true then the first player enters the stones, otherwise second player. At the end of every time the loop is executed firstPlayerMove should equal "!firstPlayerMove."

  • I have a really high score on a game app on the ipad 2 ... Can I sync or transfer ONLY that game to my ipad 3 somehow ???

    I have a really high score on a game app on my ipad 2 ... I want to sync, or transfer, or move somehow,  the app with the high score to my ipad 3... Can I do it without syncing the whole ipad?? Or is there another way to get the game app to my "3" ???

    You would need to backup your data to iTunes or iCloud and then restore from backup on the iPad 3. Content should reside on your computer or you can reload apps from the cloud. I don't believe you can just restore one app
    http://support.apple.com/kb/HT1766?viewlocale=en_US&locale=en_US

  • How do you get your old scores on your games when you transfer the games between devices ive signed into game center and my scores are there but when I open the games Im at 0 again

    how do you get your old scores on your games when you transfer the games between devices ive signed into game center and my scores are there but when I open the games Im at 0 again

    Did you do this?
    iOS: Transferring information from your current iPhone, iPad, or iPod touch to a new device

  • I need help identifying an old Macintosh game: it was a painting game where you rode a roller coaster to an art museum and you got to pick what kind of art work you were going to make. This was the early 90's and I've been trying to hunt it down

    I need help identifying an old Macintosh game: it was a painting game where you rode a roller coaster to an art museum and you got to pick what kind of art work you were going to make. It was animated, 2D i believe. This was the early 90's and I've been trying to hunt it down. I think there was some kind of animal in it, a giraffe maybe?

    Could you be thinking of Microsoft Home's "Fine Artist" for Macintosh, as shown in this Amazon.com listing?  This program was bundled with the Performa series of Macs during the mid-90s.

  • Trivia game that does NOT require data

    looking for a trivia game that does not require an Internet connection. We are going camping and like to play a trivia game around the camp fire, but there is no cell service or data or wifi. We have used Mr Trivia for the last couple years but have ran out of new questions. Looking for something simular in function. Most of what I've tryed does not funtion without running data.
    ipad, iphone or pod (mutiple generations)
    thanks

    dalewren wrote:
    Are there any carriers that allow this?
    Not that I'm aware of. In fact, many carriers, if they detect an iPhone on their network without a data plan, will either bill you for such or cancel your service.

  • Simple Trivia game

    I am attempting to design a very simple trivia game. It needs to include if and for statements. Can anyone link me to a place they know of that shows me how?

    pastramigod wrote:
    More of how to incorporate it into a trivia game.There's no specific instructions for this that I know of. You're just going to have to play and experiment with your code. In fact, I recommend that you play and experiment with your code, because even if you don't get a decent game running, you are sure to learn a lot. Please come back with your code samples if you run into problems.

  • Basic Trivia Game

    I am looking to make a trivia game as a special feature on my dvd for my kids...1 trivia game per each kid 10 questions each...After each question a track is going to with them saying YAY or NO and then it proceeds to the next question....The questions do not need to be in random order....infact id prefer they are not...also id like at the end of the quiz for a menu to say how many they got right out of how many....i have developed a way to do this however it involves using over a hundred menu's and tracks with different end jumps...i do not know anyhting about scripting but i am willing to use it if someone lays it out for me....im using DVDSP4.....and ideas?

    Do a quick search using the "more options" and search last year, just put the word "trivia" in the DVD SP forum and there are many threads. I think some of them had some details and point to projects files

  • HT5622 I am trying to buy some help on the "candy crush" game but I keep getting this pop-up" unable to purchase. This item is for an app that was purchased by a different Apple ID. to buy this item with this Apple ID you must first purchase the app. My d

    I am trying to buy help on my candy crush game but I keep getting this pop-up? Unable to Purchase. This item for an app that was purchased by a different Apple ID. To buy this item with this Apple ID, you must first purchase the app. My daughter set up this game on my Iphone. I am on level 65 and don't wont to start over if I don't have to.
    Any suggestions?

    If it was indeed purchased with a different apple ID then there is no work around for what you want! You can try signing in with your daughter's apple ID and password and update the app and purchase whatever you want then log back in with your apple ID. This may work!

Maybe you are looking for