Please help me in VB code

Status
Not open for further replies.

Chetan1991

Youngling
Hi Guys!
The following text is the source code of my multiplayer snakes and ladders game in VB.
I am not getting the desired result with it. Please tell me what are the errors in it.
--------------------------------------------------------------------------
'General Declarations
Dim C_1, C_2, C_3, C_4, C_5, C_6, C_7, C_8, C As Integer
Dim p, pcol, Last
'Decorations
Private Sub blink_Timer()
On Error Resume Next
Dim po00 As Byte
po00 = Int((Rnd * 15) + 1)
title.ForeColor = QBColor(po00)
bound1.BorderColor = QBColor(po00 + 1)
bound2.BorderColor = QBColor(po00 + 3)
End Sub

Private Sub reset_Click()
Form_Load
e(C_p).BackColor = &H80FF&
For y = 1 To 100
If y <> Cur Then e(y).BackColor = &H80000016
Next y
End Sub

Private Sub exit_Click()
End
End Sub

Private Sub Form_Load()
'obtaining the number of players from other form
Last = Val(number.num.Text)
p = "1"
C_p = 1
End Sub

Private Sub roll_Click()
Label3.Caption = Str(C_p)
'changing turns
If p = Last Then
p = 1
Else
p = p + 1
End If
'Generating a random number from 1 to 6
Randomize
C = Int((Rnd * 6) + 1)
'Displaying the number on dice
Select Case C
Case 1
dot(4).Visible = True
dot(0).Visible = False
dot(1).Visible = False
dot(2).Visible = False
dot(3).Visible = False
dot(5).Visible = False
dot(6).Visible = False
Case 2
dot(5).Visible = True
dot(0).Visible = False
dot(1).Visible = False
dot(2).Visible = True
dot(3).Visible = False
dot(4).Visible = False
dot(6).Visible = False
Case 3
dot(4).Visible = True
dot(0).Visible = False
dot(1).Visible = False
dot(2).Visible = True
dot(3).Visible = False
dot(5).Visible = True
dot(6).Visible = False
Case 4
dot(4).Visible = False
dot(0).Visible = True
dot(1).Visible = True
dot(2).Visible = True
dot(3).Visible = False
dot(5).Visible = True
dot(6).Visible = False
Case 5
dot(4).Visible = True
dot(0).Visible = True
dot(1).Visible = True
dot(2).Visible = True
dot(3).Visible = False
dot(5).Visible = True
dot(6).Visible = False
Case 6
dot(4).Visible = False
dot(0).Visible = True
dot(1).Visible = True
dot(2).Visible = True
dot(3).Visible = True
dot(5).Visible = True
dot(6).Visible = True
End Select

'Deciding winning condition
If C_p + C >= 100 Then
MsgBox (" Player " + p + "You Win!!!")
C = 0
reset_Click
End If

'Code for Snakes and ladders
If e(C_p + C).Tag = "snake" Then
MsgBox ("Caught by a snake!")
C = -1 * (Int((Rnd * 10) + C))
ElseIf e(C_p + C).Tag = "ladder" Then
MsgBox ("You got a ladder!!")
C = Int((Rnd * 10) + (C + 4))
End If

'colouring the current position
e(C_p + C).BackColor = QBColor(p)

'setting the new block as current block
C_p = C_p + C

'removing color from other blocks
For k = 1 To 100
If k <> C_p Then e(k).BackColor = &H80000016
Next k
End Sub
--------------------------------------------------------------------------
 

CadCrazy

in search of myself
Digit forum is not multithreading campatible
*www.thinkdigit.com/forum/showthread.php?p=724561
 
Status
Not open for further replies.
Top Bottom