home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form AsciiGame
- BorderStyle = 1 'Fixed Single
- Caption = "Ascii Game"
- ClientHeight = 1695
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 2895
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 1695
- ScaleWidth = 2895
- StartUpPosition = 3 'Windows Default
- Begin VB.Timer Timer1
- Left = 1320
- Top = 240
- End
- Begin VB.Frame fmeScore
- Caption = "Score"
- Height = 615
- Left = 120
- TabIndex = 4
- Top = 960
- Width = 2655
- Begin VB.Label lblScore
- Caption = "0"
- Height = 255
- Left = 360
- TabIndex = 5
- Top = 240
- Width = 2055
- End
- End
- Begin VB.TextBox txtChar
- Height = 375
- Left = 1560
- TabIndex = 1
- Top = 480
- Width = 1215
- End
- Begin VB.TextBox txtAscii
- Height = 375
- Left = 120
- TabIndex = 0
- Top = 480
- Width = 1215
- End
- Begin VB.Label lblChar
- Alignment = 2 'Center
- Caption = "Character"
- Height = 255
- Left = 1560
- TabIndex = 3
- Top = 120
- Width = 1215
- End
- Begin VB.Label lblAscii
- Alignment = 2 'Center
- Caption = "Ascii"
- Height = 255
- Left = 120
- TabIndex = 2
- Top = 120
- Width = 1215
- End
- Attribute VB_Name = "AsciiGame"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Dim temp1 As Integer, temp2 As Integer, score As Integer
- Private Sub Form_Load()
- score = 1
- Timer1.Interval = 5000
- MsgBox ( _
- "RULES:" _
- & Chr(13) & Chr(13) & _
- "Fill in the blank text box so that it " & _
- "matches the ascii code or character " & _
- "filled in the other text box." _
- & Chr(13) & Chr(13) & _
- "The left text box contains the ascii code" _
- & Chr(13) & _
- "The right text box contains the character" _
- & Chr(13) & Chr(13) & _
- "Every 5 seconds a new round starts" _
- & Chr(13) & _
- "If you don't fill in the blank correctly, " & _
- "you lose a point" _
- & Chr(13) & _
- "If you fill it in correctly, you gain a point." _
- & Chr(13) & Chr(13) & _
- "Have fun!" _
- )
- Timer1.Enabled = True
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- Timer1.Enabled = False
- End Sub
- Private Sub Timer1_Timer()
- If txtAscii.Text = "" Or txtChar.Text = "" Then
- scoreDown
- Else
- If txtAscii.Text = Asc(txtChar.Text) Then
- scoreUp
- Else
- scoreDown
- End If
- End If
- txtAscii.Enabled = True
- txtChar.Enabled = True
- txtAscii.Text = ""
- txtChar.Text = ""
- Randomize
- temp1 = Int((Rnd * 2) + 1)
- If temp1 = 1 Then
- txtAscii.Text = Int((Rnd * 94) + 33) '33-126
- txtAscii.Enabled = False
- ElseIf temp1 = 2 Then
- txtChar.Text = Chr(Int((Rnd * 94) + 33)) '33-126
- txtChar.Enabled = False
- End If
- End Sub
- Sub scoreDown()
- score = score - 1
- lblScore.Caption = score
- End Sub
- Sub scoreUp()
- score = score + 1
- lblScore.Caption = score
- End Sub
- Private Sub txtAscii_Change()
- If IsNumeric(txtAscii.Text) = False Then
- txtAscii.Text = ""
- ElseIf txtAscii.Text < 0 Then
- txtAscii.Text = 0
- ElseIf txtAscii.Text > 255 Then
- txtAscii.Text = 255
- End If
- End Sub
- Private Sub txtChar_Change()
- If Len(txtChar.Text) > 1 Then
- txtChar.Text = ""
- End If
- End Sub
-