|
-
Jul 19th, 2009, 03:38 AM
#1
Thread Starter
New Member
[RESOLVED] I need help with a score problem in my vb 2008 game
Hi guys, i am making a guess the number game, i have all that down good, now i am adding a score system. I thought i had it good, but it takes away all the points i put in for the different difficulties.
like, if you get the number on the easy level you get 1 point
Points:
easy = 1
medium = 5
hard = 10
impossible = 100
and if you get it wrong it takes away 1 point
but when i get it wrong, it takes away 5 points, and if i get it right i get 116 points
please help me.
Code:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim random As New Random
' Easy difficulty
If RadioButton1.Checked = True Then
Label1.Text = random.Next(1, 10)
End If
If TextBox1.Text = Label1.Text Then
'add score
score.Text += 1
'
Label2.Visible = True
Label3.Visible = True
Label3.Text = "You are CORRECT!"
Button1.Enabled = False
TextBox1.Enabled = False
Else : Label2.Visible = True
' minus score
score.Text -= 2
'
Label3.Visible = True
Label3.Text = "You are WRONG!"
Button1.Enabled = False
TextBox1.Enabled = False
End If
' Medium difficulty
If RadioButton2.Checked = True Then
Label1.Text = random.Next(1, 50)
End If
If TextBox1.Text = Label1.Text Then
'add score
score.Text += 5
'
Label2.Visible = True
Label3.Visible = True
Label3.Text = "You are CORRECT!"
Button1.Enabled = False
TextBox1.Enabled = False
Else : Label2.Visible = True
' minus score
score.Text -= 1
'
Label3.Visible = True
Label3.Text = "You are WRONG!"
Button1.Enabled = False
TextBox1.Enabled = False
End If
' Hard difficulty
If RadioButton3.Checked = True Then
Label1.Text = random.Next(1, 100)
End If
If TextBox1.Text = Label1.Text Then
'add score
score.Text += 10
'
Label2.Visible = True
Label3.Visible = True
Label3.Text = "You are CORRECT!"
Button1.Enabled = False
TextBox1.Enabled = False
Else : Label2.Visible = True
' minus score
score.Text -= 1
'
Label3.Visible = True
Label3.Text = "You are Wrong!"
Button1.Enabled = False
TextBox1.Enabled = False
End If
' Impossible difficulty
If RadioButton4.Checked = True Then
Label1.Text = random.Next(1, 10000)
Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 36.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
End If
If TextBox1.Text = Label1.Text Then
'add score
score.Text += 100
'
Label2.Visible = True
Label3.Visible = True
Label3.Text = "You are CORRECT!"
Button1.Enabled = False
TextBox1.Enabled = False
Else : Label2.Visible = True
' minus score
score.Text -= 1
'
Label3.Visible = True
Label3.Text = "You are WRONG!"
Button1.Enabled = False
TextBox1.Enabled = False
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Button1.Enabled = True
TextBox1.Enabled = True
Label2.Visible = False
Label3.Visible = False
Label1.Text = "0"
TextBox1.Text = ""
Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 72.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
End Sub
Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
Process.Start("http://cyked.ucoz.com")
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
AboutBox1.Show()
End Sub
End Class
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|