Escolar Documentos
Profissional Documentos
Cultura Documentos
Controles utilizados
- Form1
Borderstyle=3 Fixed dialog
Startupposition=2 center screen
- Frminicio
- Frmjuego
Visible=false
- Frmpuntos
Visible=false
- Cmbjugar
- Cmbp
- Cmbsalir
- Cmbs
- Cmbnuevoj
- Cmbmenu
- Cmbsalirj
- Cmbmp
- Lblpuntaje
- List1
- Tmrpausa
Enable=false
Interval=300
- Tmrboton
Ebnable=false
Interval=0
- Tmrcolor
Enable=false
Interval=150
Jugando,
Puntajes,
Cdigo
Variablea a utilizar
Nom As String * 25
Points As Integer
End Type
Otras variables
Dim colores(3000) As Integer ' guardar las secuendia se pone un valor grande
c = 10
For i = 0 To 9
Score(i).Nom = "Anonimo"
Score(i).Points = c
c=c-1
Next
ViewScore
Else
End If
Close #1
ViewScore
SaveScore
End Sub
Sub ViewScore()
List1.Clear
var = ""
For i = 0 To 9
var = " " & Str(i + 1) + ".- " & Score(i).Nom & Str(Score(i).Points)
List1.AddItem (var)
Next i
End Sub
Sub SaveScore()
Close #1
End Sub
Sub OrdenarScores()
Dim sw As Integer
sw = 0
Do Until sw = 1
sw = 1
For X = 0 To 8
sw = 0
aux = Score(X).Points
aux2 = Score(X).Nom
End If
Next
Loop
ViewScore
End Sub
Sub terminar()
If menzaje = 6 Then
End
Else
' no se sale
End If
End Sub
terminar
End Sub
terminar
End Sub
Pasar a men desde el juego se ocultan los contenedores para evitar usar
mas formularios y se inhabilitan los contadores de tiempo
Me.tmrboton.Enabled = False
Me.tmrboton.Enabled = False
Me.tmrpausa.Enabled = False
Me.frminicio.Visible = True
Me.frmjuego.Visible = False
End Sub
Iniciar nuevo juego desde el juego se ocultan los contenedores para evitar
usar mas formularios y se inhabilitan los contadores de tiempo
Me.tmrboton.Enabled = False
Me.tmrboton.Enabled = False
Me.tmrpausa.Enabled = False
jugar
End Sub
Me.frmpuntos.Visible = False
Me.frminicio.Visible = True
End Sub
Me.frminicio.Visible = False
Me.frmpuntos.Visible = True
End Sub
Botn jugar men se ocultan los contenedores para evitar usar mas
formularios
Me.frminicio.Visible = False
Me.frmjuego.Visible = True
jugar
End Sub
inicio
End Sub
Sub inicio()
Me.lblpuntaje.Caption = 0
nivel = 0
velocidad = 1000
clicks = 0
cambio = 0
color = 0
botonfalso
Me.tmrboton.Interval = velocidad
Me.tmrboton.Enabled = True
End Sub
For j = 0 To 3
Me.cmbs(j).Enabled = False
Next j
End Sub
Control de tiempo
Randomize
aleatorio = Int(Rnd * 4)
Me.tmrpausa.Enabled = True
Me.tmrboton.Enabled = False
End Sub
Else
coloresorigen
color = 0
Me.tmrpausa.Enabled = False
botonestrue
Else
End If
cambio = 0
End If
End Sub
Me.cmbs(0).BackColor = &H8080FF
Me.cmbs(1).BackColor = &HFFFF80
Me.cmbs(2).BackColor = &H80FFFF
Me.cmbs(3).BackColor = &H80FF80
End Sub
For j = 0 To 3
Me.cmbs(j).Enabled = True
Next j
End Sub
colorj = Index
botonactivo colorj
End Sub
If cambio = 0 Then
cambio = 1
Else
coloresorigen
puntaje = puntaje + 1
Me.lblpuntaje.Caption = puntaje
botonfalso
clicks = 0
Me.tmrcolor.Enabled = False
botonestrue
clicks = clicks + 1
Me.tmrcolor.Enabled = False
End If
cambio = 0
Else
Me.tmrcolor.Enabled = False
Me.frmjuego.Visible = False
Me.frmpuntos.Visible = True
End If
End If
End Sub
Procedimiento final
Sub final()
Score(9).Points = puntaje
OrdenarScores
SaveScore
Else
End If
End Sub
Case 0
Me.cmbs(0).BackColor = &HC0&
Case 1
Me.cmbs(1).BackColor = &H808000
Case 2
Me.cmbs(2).BackColor = &HFFFF&
Case 3
Me.cmbs(3).BackColor = &H8000&
End Select
End Sub
Sub cargarnivel()
nivel = nivel + 1
If velocidad = 50 Then
'limite velocidad
Else
velocidad = velocidad - 50
End If
Me.tmrboton.Interval = velocidad
Me.tmrboton.Enabled = True
End Sub
PD1. El cdigo utilizado ni la lgica son las ms ptimas para este juego y el
cdigo puede ser modificado por el lector.