Fucking FAILURE! - Shad0w
 
HomePortalMemberlistRegisterLog in
Top posters
shad0w
 
rdwuestewald
 
Crush Combat
 
banksy
 
Kewley
 
Ashley
 
Anthony
 
Inix
 
mitch
 
dukemaster95
 
Who is online?
In total there is 1 user online :: 0 Registered, 0 Hidden and 1 Guest

None

Most users ever online was 13 on Fri Mar 09, 2018 8:56 pm

Share | 
 

 [VB6] Hi-Lo [Game]

Go down 
AuthorMessage
shad0w



Number of posts : 173
Points : 238
Reputation : 0
Registration date : 2009-03-18
Location : 127.0.0.1

PostSubject: [VB6] Hi-Lo [Game]   Thu Mar 19, 2009 7:22 pm

This program creates a game of hi-lo where you get to risk point and gain double or lose points. Kind of like a guessing game but with points.

Code:
'************************************************************
'Creates a game of hi-lo where the player risks points and gains double
'if his guess is in the correct range.
'************************************************************

Option Explicit

Private intrandom As Integer
Const inthigh As Integer = 13
Const intlow As Integer = 1
Private intrisk As Integer
Private intplayertotal As Integer

Private Sub cmdDone_Click()
    Unload Me
End Sub

Private Sub cmdhigh_Click()
    intrandom = rndint(inthigh, intlow)
    intrisk = txtrisk.Text

    If intrandom >= 8 And intrandom <= 13 Then
          intplayertotal = intplayertotal + (2 * intrisk)
          lblmessage.Caption = "You Win! The number was " & intrandom & vbCrLf & "Total points = " intplayertotal
    Else 
          lblmessage.Caption = "You Lose! The number was " & intrandom & vbCrLf & "Total points = " intplayertotal
    End If
End Sub

Private Sub cmdlow_Click()
    intrandom = rndint(inthigh, intlow)
    intrisk = txtrisk.Text

    If intrandom >= 1 And intrandom <= 6 Then
              intplayertotal = intplayertotal + (2 * intrisk)
          lblmessage.Caption = "You Win! The number was " & intrandom & vbCrLf & "Total points = " intplayertotal
    Else 
          lblmessage.Caption = "You Lose! The number was " & intrandom & vbCrLf & "Total points = " intplayertotal
    End If
End Sub

Private Sub Form_Load()
    Randomize
    intplayertotal = 1000
End Sub

Private Sub txtrisk_Change()
    lblmessage.Caption = ""
End Sub

'********************************************************
'Finds a random number between 13 and 1 and assigns it to rndint
'
'post: rndint is a random number between 1 and 13.
'********************************************************

Function rndint(ByVal inthigh As Integer, ByVal intlow As Integer) As Integer
    rndint = Int(inthigh * Rnd + intlow)
End Function
Back to top Go down
 
[VB6] Hi-Lo [Game]
Back to top 
Page 1 of 1
 Similar topics
-
» This game sure can be adamant about wanting players to take certain weapons
» Luck O' the Bearish Instant Win Game
» The wish game
» Outcry. The shimmering game
» What Would You Like In A New Tex Murphy Game?

Permissions in this forum:You cannot reply to topics in this forum
Fucking FAILURE! - Shad0w :: Shad0w's Computer Section :: Coding :: Visual Basic-
Jump to: