Results 1 to 9 of 9

Thread: [RESOLVED] [VB.Net] Game Scoring System - How can I Do This?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2009
    Posts
    22

    Resolved [RESOLVED] [VB.Net] Game Scoring System - How can I Do This?

    Hi,

    I was just wondering, how can i create a scoring for system for my Maths quiz game made using VB.

    My quiz game can generate automatic numbers / questions and shows a message box whenever the user gets the answer right or wrong. i.e.

    when the user presses the check answer button, a message appears stating that he/she go it right or wrong. Then the user can press the next question button to get a new question.

    Although now i need a scoring system which have no idea how to create

    im totally lost

    Thanks

  2. #2
    Frenzied Member stateofidleness's Avatar
    Join Date
    Jan 2009
    Posts
    1,780

    Re: [VB.Net] Game Scoring System - How can I Do This?

    well, how much is a correct question worth? do you lose points if you get one wrong? is there a target score to go to a different "level", or a neverending cumulating score? do the point values increase as you go on?

    we need more info.

    it's pretty easy to do, but you need to give us some more detailed information.

    vb.net Code:
    1. Dim score as Integer = 0
    2. If answer Then
    3. score += 1
    4. Else
    5. score -= 1
    6. End if

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Aug 2009
    Posts
    22

    Re: [VB.Net] Game Scoring System - How can I Do This?

    heres my code

    Code:
            Dim score As Integer = 0
            TextBox2.Text = score
            If Decimal.TryParse(TextBox1.Text, userAnswer) Then
                If answer = userAnswer Then
                    score += 1
                    MsgBox("Congrats")

    for some reason it just wont work.

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Aug 2009
    Posts
    22

    Re: [VB.Net] Game Scoring System - How can I Do This?

    Quote Originally Posted by stateofidleness View Post
    well, how much is a correct question worth? do you lose points if you get one wrong? is there a target score to go to a different "level", or a neverending cumulating score? do the point values increase as you go on?

    we need more info.

    it's pretty easy to do, but you need to give us some more detailed information.
    There are 10 questions in total (im not quite show how to only generate 10 as it just generates random forumales)

    Each question is worth 1 point

    There is no target sscore to go to a particular level; a message box will only appear stating congrats you got X mark out of 10 or something.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Aug 2009
    Posts
    22

    Re: [VB.Net] Game Scoring System - How can I Do This?

    Edit

  6. #6
    Addicted Member garyjohn_2000's Avatar
    Join Date
    Apr 2005
    Location
    Timbaland
    Posts
    243

    Re: [VB.Net] Game Scoring System - How can I Do This?

    Maybe it is because you're initializing the score in the same procedure that you're adding it to?
    I am assuming the snippet you posted is from the "Check Answer" [or something like that] button's Click event handler.

    Here's how I would go about it:

    Code:
    'Declarations
    Private score As Integer = 0
    Private userAnswer As Decimal
    
    '...Form Initialization Code...
    
    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        If Decimal.TryParse(TextBox1.Text, userAnswer) Then
            If answer = userAnswer Then
                score += 1
                TextBox2.Text = score
                MsgBox("Congrats")
            Else
                MsgBox("Incorrect Answer")
            End If
        End If
    End Sub


    Anyone who has never made a mistake has never tried anything new. - Einstein
    Peace!

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Aug 2009
    Posts
    22

    Re: [VB.Net] Game Scoring System - How can I Do This?

    Quote Originally Posted by garyjohn_2000 View Post

    Here's how I would go about it:
    OMG Thankyou it worked

    1 more question

    does anyone now how to implement a reset feature for example when the user does about 10 questions a message box appears stating that the user either has them all correct or has some wrong then it resets the counter, so that the user can start again.

    cause currently the questions are infinite lol

    thanks

    edit: incase my explanation doesnt make sense, i provided a peice of code that boviously doesnt work (but i hope you get the general idea of what i mean )

    Code:
            If Button2.pressed = 10 Then
        msgbox = scoreresult else
                Reset(score)
    Last edited by toshiba; Aug 7th, 2009 at 07:52 PM.

  8. #8
    Frenzied Member stateofidleness's Avatar
    Join Date
    Jan 2009
    Posts
    1,780

    Re: [VB.Net] Game Scoring System - How can I Do This?

    well what I would do is on form load call a "question generating" sub that would generate 10 questions with a for loop:

    for x as Integer = 0 to 9
    'create a question
    'store it in an array at index i
    next

    Each time a question is asked, increment a questionCount variable by 1

    then in the button's Click Event, you would check to see if questionCount = 10, if so, then call your msgbox.

    to reset the score, just set the playersScore = 0 and call your "question generating" sub again.

  9. #9
    New Member Noooshi's Avatar
    Join Date
    Aug 2009
    Posts
    7

    Re: [RESOLVED] [VB.Net] Game Scoring System - How can I Do This?

    the simplest can be is
    if the answer is "dog" then
    If Textbox1.Text = "dog" then
    Score.Text = Score.Text + 1
    else
    // What ever you want :P
    // Can be..
    Score.Text = Score.Text - 1
    End if

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width