home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / JCG_Tetris20261610202006.psc / main.frm < prev    next >
Text File  |  2006-10-17  |  68KB  |  2,204 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    BackColor       =   &H00000000&
  4.    BorderStyle     =   1  'Fixed Single
  5.    ClientHeight    =   9345
  6.    ClientLeft      =   15
  7.    ClientTop       =   15
  8.    ClientWidth     =   9030
  9.    ControlBox      =   0   'False
  10.    FillColor       =   &H000080FF&
  11.    BeginProperty Font 
  12.       Name            =   "MS Sans Serif"
  13.       Size            =   13.5
  14.       Charset         =   0
  15.       Weight          =   400
  16.       Underline       =   0   'False
  17.       Italic          =   0   'False
  18.       Strikethrough   =   0   'False
  19.    EndProperty
  20.    ForeColor       =   &H000080FF&
  21.    Icon            =   "main.frx":0000
  22.    LinkTopic       =   "Form1"
  23.    MaxButton       =   0   'False
  24.    MinButton       =   0   'False
  25.    ScaleHeight     =   9345
  26.    ScaleWidth      =   9030
  27.    StartUpPosition =   2  'CenterScreen
  28.    Begin VB.Frame Frame2 
  29.       BackColor       =   &H00000000&
  30.       BeginProperty Font 
  31.          Name            =   "MS Sans Serif"
  32.          Size            =   8.25
  33.          Charset         =   0
  34.          Weight          =   400
  35.          Underline       =   0   'False
  36.          Italic          =   0   'False
  37.          Strikethrough   =   0   'False
  38.       EndProperty
  39.       Height          =   3240
  40.       Left            =   5820
  41.       TabIndex        =   15
  42.       Top             =   4290
  43.       Width           =   2670
  44.       Begin VB.Label Label15 
  45.          Alignment       =   2  'Center
  46.          BackStyle       =   0  'Transparent
  47.          Caption         =   "obstacles"
  48.          BeginProperty Font 
  49.             Name            =   "MS Sans Serif"
  50.             Size            =   8.25
  51.             Charset         =   0
  52.             Weight          =   400
  53.             Underline       =   0   'False
  54.             Italic          =   0   'False
  55.             Strikethrough   =   0   'False
  56.          EndProperty
  57.          ForeColor       =   &H000080FF&
  58.          Height          =   210
  59.          Left            =   1590
  60.          TabIndex        =   19
  61.          Top             =   2865
  62.          Width           =   705
  63.       End
  64.       Begin VB.Label Label14 
  65.          Alignment       =   2  'Center
  66.          BackStyle       =   0  'Transparent
  67.          Caption         =   "strafe"
  68.          BeginProperty Font 
  69.             Name            =   "MS Sans Serif"
  70.             Size            =   8.25
  71.             Charset         =   0
  72.             Weight          =   400
  73.             Underline       =   0   'False
  74.             Italic          =   0   'False
  75.             Strikethrough   =   0   'False
  76.          EndProperty
  77.          ForeColor       =   &H000080FF&
  78.          Height          =   210
  79.          Left            =   375
  80.          TabIndex        =   18
  81.          Top             =   2865
  82.          Width           =   705
  83.       End
  84.       Begin VB.Label Label13 
  85.          Alignment       =   2  'Center
  86.          BackStyle       =   0  'Transparent
  87.          Caption         =   "rising"
  88.          BeginProperty Font 
  89.             Name            =   "MS Sans Serif"
  90.             Size            =   8.25
  91.             Charset         =   0
  92.             Weight          =   400
  93.             Underline       =   0   'False
  94.             Italic          =   0   'False
  95.             Strikethrough   =   0   'False
  96.          EndProperty
  97.          ForeColor       =   &H000080FF&
  98.          Height          =   210
  99.          Left            =   1590
  100.          TabIndex        =   17
  101.          Top             =   1440
  102.          Width           =   705
  103.       End
  104.       Begin VB.Label Label12 
  105.          Alignment       =   2  'Center
  106.          BackStyle       =   0  'Transparent
  107.          Caption         =   "clasico"
  108.          BeginProperty Font 
  109.             Name            =   "MS Sans Serif"
  110.             Size            =   8.25
  111.             Charset         =   0
  112.             Weight          =   400
  113.             Underline       =   0   'False
  114.             Italic          =   0   'False
  115.             Strikethrough   =   0   'False
  116.          EndProperty
  117.          ForeColor       =   &H000080FF&
  118.          Height          =   210
  119.          Left            =   375
  120.          TabIndex        =   16
  121.          Top             =   1440
  122.          Width           =   705
  123.       End
  124.       Begin VB.Image Image1 
  125.          Height          =   1185
  126.          Index           =   3
  127.          Left            =   1500
  128.          Picture         =   "main.frx":08CA
  129.          Top             =   1710
  130.          Width           =   885
  131.       End
  132.       Begin VB.Image Image1 
  133.          Height          =   1185
  134.          Index           =   2
  135.          Left            =   285
  136.          Picture         =   "main.frx":4098
  137.          Top             =   1710
  138.          Width           =   885
  139.       End
  140.       Begin VB.Image Image1 
  141.          Height          =   1185
  142.          Index           =   1
  143.          Left            =   1500
  144.          Picture         =   "main.frx":7866
  145.          Top             =   285
  146.          Width           =   885
  147.       End
  148.       Begin VB.Image Image1 
  149.          Height          =   1185
  150.          Index           =   0
  151.          Left            =   285
  152.          Picture         =   "main.frx":B034
  153.          Top             =   285
  154.          Width           =   885
  155.       End
  156.    End
  157.    Begin VB.TextBox Text2 
  158.       BeginProperty Font 
  159.          Name            =   "MS Sans Serif"
  160.          Size            =   8.25
  161.          Charset         =   0
  162.          Weight          =   400
  163.          Underline       =   0   'False
  164.          Italic          =   0   'False
  165.          Strikethrough   =   0   'False
  166.       EndProperty
  167.       Height          =   285
  168.       Left            =   7965
  169.       TabIndex        =   6
  170.       Text            =   "Text2"
  171.       Top             =   9555
  172.       Width           =   810
  173.    End
  174.    Begin VB.Frame Frame1 
  175.       BackColor       =   &H00000000&
  176.       BeginProperty Font 
  177.          Name            =   "MS Sans Serif"
  178.          Size            =   8.25
  179.          Charset         =   0
  180.          Weight          =   400
  181.          Underline       =   0   'False
  182.          Italic          =   0   'False
  183.          Strikethrough   =   0   'False
  184.       EndProperty
  185.       ForeColor       =   &H00000000&
  186.       Height          =   3255
  187.       Left            =   5820
  188.       TabIndex        =   1
  189.       Top             =   840
  190.       Width           =   2685
  191.       Begin VB.PictureBox Picture2 
  192.          Appearance      =   0  'Flat
  193.          BackColor       =   &H00000000&
  194.          BorderStyle     =   0  'None
  195.          BeginProperty Font 
  196.             Name            =   "MS Sans Serif"
  197.             Size            =   8.25
  198.             Charset         =   0
  199.             Weight          =   400
  200.             Underline       =   0   'False
  201.             Italic          =   0   'False
  202.             Strikethrough   =   0   'False
  203.          EndProperty
  204.          ForeColor       =   &H00000000&
  205.          Height          =   1305
  206.          Left            =   675
  207.          ScaleHeight     =   87
  208.          ScaleMode       =   3  'Pixel
  209.          ScaleWidth      =   97
  210.          TabIndex        =   5
  211.          Top             =   210
  212.          Width           =   1455
  213.       End
  214.       Begin VB.Label Label9 
  215.          BackStyle       =   0  'Transparent
  216.          Caption         =   "Modo: "
  217.          BeginProperty Font 
  218.             Name            =   "Comic Sans MS"
  219.             Size            =   9.75
  220.             Charset         =   0
  221.             Weight          =   700
  222.             Underline       =   0   'False
  223.             Italic          =   0   'False
  224.             Strikethrough   =   0   'False
  225.          EndProperty
  226.          ForeColor       =   &H000000FF&
  227.          Height          =   285
  228.          Left            =   195
  229.          TabIndex        =   12
  230.          Top             =   2835
  231.          Width           =   2310
  232.       End
  233.       Begin VB.Label Label4 
  234.          BackStyle       =   0  'Transparent
  235.          Caption         =   "Puntaje:"
  236.          BeginProperty Font 
  237.             Name            =   "Comic Sans MS"
  238.             Size            =   9.75
  239.             Charset         =   0
  240.             Weight          =   700
  241.             Underline       =   0   'False
  242.             Italic          =   0   'False
  243.             Strikethrough   =   0   'False
  244.          EndProperty
  245.          ForeColor       =   &H000000FF&
  246.          Height          =   285
  247.          Left            =   195
  248.          TabIndex        =   4
  249.          Top             =   2475
  250.          Width           =   1755
  251.       End
  252.       Begin VB.Label Label3 
  253.          BackStyle       =   0  'Transparent
  254.          Caption         =   "Lineas:"
  255.          BeginProperty Font 
  256.             Name            =   "Comic Sans MS"
  257.             Size            =   9.75
  258.             Charset         =   0
  259.             Weight          =   700
  260.             Underline       =   0   'False
  261.             Italic          =   0   'False
  262.             Strikethrough   =   0   'False
  263.          EndProperty
  264.          ForeColor       =   &H000000FF&
  265.          Height          =   270
  266.          Left            =   210
  267.          TabIndex        =   3
  268.          Top             =   2115
  269.          Width           =   1320
  270.       End
  271.       Begin VB.Label Label2 
  272.          BackStyle       =   0  'Transparent
  273.          Caption         =   "Nivel:"
  274.          BeginProperty Font 
  275.             Name            =   "Comic Sans MS"
  276.             Size            =   9.75
  277.             Charset         =   0
  278.             Weight          =   700
  279.             Underline       =   0   'False
  280.             Italic          =   0   'False
  281.             Strikethrough   =   0   'False
  282.          EndProperty
  283.          ForeColor       =   &H000000FF&
  284.          Height          =   270
  285.          Left            =   210
  286.          TabIndex        =   2
  287.          Top             =   1740
  288.          Width           =   1215
  289.       End
  290.    End
  291.    Begin VB.PictureBox Picture1 
  292.       Appearance      =   0  'Flat
  293.       AutoRedraw      =   -1  'True
  294.       BackColor       =   &H00000000&
  295.       BeginProperty Font 
  296.          Name            =   "MS Sans Serif"
  297.          Size            =   13.5
  298.          Charset         =   0
  299.          Weight          =   700
  300.          Underline       =   0   'False
  301.          Italic          =   0   'False
  302.          Strikethrough   =   0   'False
  303.       EndProperty
  304.       ForeColor       =   &H80000008&
  305.       Height          =   7950
  306.       Left            =   510
  307.       ScaleHeight     =   528
  308.       ScaleMode       =   3  'Pixel
  309.       ScaleWidth      =   317
  310.       TabIndex        =   0
  311.       Top             =   915
  312.       Width           =   4785
  313.       Begin VB.Label Label11 
  314.          Alignment       =   2  'Center
  315.          BackColor       =   &H00000000&
  316.          Caption         =   "x 3"
  317.          ForeColor       =   &H000080FF&
  318.          Height          =   345
  319.          Left            =   1740
  320.          TabIndex        =   14
  321.          Top             =   3540
  322.          Visible         =   0   'False
  323.          Width           =   1245
  324.       End
  325.       Begin VB.Label Label10 
  326.          Alignment       =   2  'Center
  327.          BackColor       =   &H00000040&
  328.          BackStyle       =   0  'Transparent
  329.          Caption         =   "Rising..."
  330.          ForeColor       =   &H000080FF&
  331.          Height          =   345
  332.          Left            =   1755
  333.          TabIndex        =   13
  334.          Top             =   3510
  335.          Visible         =   0   'False
  336.          Width           =   1245
  337.       End
  338.       Begin VB.Label Label8 
  339.          BackColor       =   &H00000000&
  340.          Caption         =   "PAUSA"
  341.          ForeColor       =   &H000080FF&
  342.          Height          =   345
  343.          Left            =   2280
  344.          TabIndex        =   11
  345.          Top             =   2640
  346.          Visible         =   0   'False
  347.          Width           =   990
  348.       End
  349.       Begin VB.Label Label1 
  350.          BackColor       =   &H00000000&
  351.          Caption         =   "PREPARATE !"
  352.          ForeColor       =   &H000080FF&
  353.          Height          =   345
  354.          Left            =   1455
  355.          TabIndex        =   8
  356.          Top             =   3345
  357.          Visible         =   0   'False
  358.          Width           =   1905
  359.       End
  360.       Begin VB.Label Label5 
  361.          BackColor       =   &H00000000&
  362.          Caption         =   "5"
  363.          ForeColor       =   &H000080FF&
  364.          Height          =   345
  365.          Left            =   2235
  366.          TabIndex        =   7
  367.          Top             =   3720
  368.          Visible         =   0   'False
  369.          Width           =   210
  370.       End
  371.    End
  372.    Begin VB.Timer Timer1 
  373.       Enabled         =   0   'False
  374.       Interval        =   375
  375.       Left            =   8325
  376.       Top             =   8790
  377.    End
  378.    Begin VB.Image Image2 
  379.       Height          =   480
  380.       Left            =   60
  381.       Picture         =   "main.frx":E802
  382.       Top             =   60
  383.       Width           =   480
  384.    End
  385.    Begin VB.Shape Shape1 
  386.       BorderColor     =   &H000080FF&
  387.       BorderWidth     =   2
  388.       Height          =   9335
  389.       Left            =   10
  390.       Top             =   10
  391.       Width           =   9020
  392.    End
  393.    Begin VB.Label Label7 
  394.       BackStyle       =   0  'Transparent
  395.       Caption         =   " x"
  396.       ForeColor       =   &H00FF0000&
  397.       Height          =   375
  398.       Left            =   8580
  399.       TabIndex        =   10
  400.       Top             =   75
  401.       Width           =   315
  402.    End
  403.    Begin VB.Label Label6 
  404.       Alignment       =   2  'Center
  405.       Appearance      =   0  'Flat
  406.       BackColor       =   &H00000040&
  407.       BackStyle       =   0  'Transparent
  408.       BorderStyle     =   1  'Fixed Single
  409.       Caption         =   "-=  TETRIS  =-"
  410.       BeginProperty Font 
  411.          Name            =   "Monotype Corsiva"
  412.          Size            =   14.25
  413.          Charset         =   0
  414.          Weight          =   400
  415.          Underline       =   0   'False
  416.          Italic          =   -1  'True
  417.          Strikethrough   =   0   'False
  418.       EndProperty
  419.       ForeColor       =   &H000080FF&
  420.       Height          =   390
  421.       Left            =   705
  422.       TabIndex        =   9
  423.       Top             =   90
  424.       Width           =   7725
  425.    End
  426. End
  427. Attribute VB_Name = "Form1"
  428. Attribute VB_GlobalNameSpace = False
  429. Attribute VB_Creatable = False
  430. Attribute VB_PredeclaredId = True
  431. Attribute VB_Exposed = False
  432. 'Desarrollado Por Julio C. Gotuzzo
  433. 'Buenos Aires - Argentina
  434. 'gotuzzo@excite.com
  435.  
  436. Private Type Bloque
  437.  X As Long
  438.  Y As Long
  439.  visible As Boolean
  440. End Type
  441.  
  442. Private Type Pieza
  443.  visible As Boolean
  444.  color As Long
  445.  tipo As Integer
  446.  rot As Integer
  447.  bloque1 As Bloque
  448.  bloque2 As Bloque
  449.  bloque3 As Bloque
  450.  bloque4 As Bloque
  451. End Type
  452.  
  453. Private piezas As Pieza
  454. Private matris(20, 12) As Integer
  455. Public pieza_sig As Integer
  456. Public puntaje As Long
  457. Public lineas As Long
  458. Public nivel As Integer
  459. Private modo As Integer
  460. Private contador_piezas As Integer
  461. Private CURX, CURY As Single
  462.  
  463. Public Sub iniciar_matris()
  464.  Dim n As Integer
  465.  Dim f As Integer
  466.  n = 0
  467.  Do While n <= 20
  468.   f = 0
  469.   Do While f <= 12
  470.    If f = 0 And n <= 19 Then
  471.     matris(n, f) = 1
  472.    Else
  473.     If f = 12 And n <= 19 Then
  474.      matris(n, f) = 1
  475.     Else
  476.      If n = 20 Then
  477.       matris(n, f) = 1
  478.      Else
  479.       matris(n, f) = 0
  480.      End If
  481.     End If
  482.    End If
  483.    f = f + 1
  484.   Loop
  485.   n = n + 1
  486.  Loop
  487. End Sub
  488.  
  489. Public Sub dibujar_matris()
  490.  Dim n As Integer
  491.  Dim f As Integer
  492.  n = 0
  493.  Do While n <= 19
  494.   f = 1
  495.   Do While f <= 11
  496.    If matris(n, f) = 0 Then
  497.     cuadrado_relleno f * 24, n * 24, 26, Picture1.BackColor, Picture1
  498.    End If
  499.    f = f + 1
  500.   Loop
  501.   n = n + 1
  502.  Loop
  503.  n = 0
  504.  Do While n <= 20
  505.   f = 0
  506.   Do While f <= 12
  507.    If matris(n, f) > 0 Then
  508.     Select Case matris(n, f)
  509.     Case Is = 1
  510.      cuadrado_relleno (f * 24) + 2, (n * 24) + 2, 22, &HC0C0C0, Picture1
  511.     Case Is = 2
  512.      cuadrado_relleno (f * 24) + 2, (n * 24) + 2, 22, &HFF0000, Picture1
  513.     Case Is = 3
  514.      cuadrado_relleno (f * 24) + 2, (n * 24) + 2, 22, &HFF&, Picture1
  515.     Case Is = 4
  516.      cuadrado_relleno (f * 24) + 2, (n * 24) + 2, 22, &HFFFF&, Picture1
  517.     Case Is = 5
  518.      cuadrado_relleno (f * 24) + 2, (n * 24) + 2, 22, &HFFFF00, Picture1
  519.     Case Is = 6
  520.      cuadrado_relleno (f * 24) + 2, (n * 24) + 2, 22, &HFFFF00, Picture1
  521.     Case Is = 7
  522.      cuadrado_relleno (f * 24) + 2, (n * 24) + 2, 22, &HC000&, Picture1
  523.     Case Is = 8
  524.      cuadrado_relleno (f * 24) + 2, (n * 24) + 2, 22, &HC000&, Picture1
  525.     End Select
  526.     cuadrado_vacio f * 24, n * 24, 24, 0, Picture1
  527.     cuadrado_vacio (f * 24) + 1, (n * 24) + 1, 24, 0, Picture1
  528.    End If
  529.    f = f + 1
  530.   Loop
  531.   n = n + 1
  532.  Loop
  533. End Sub
  534.  
  535. Public Sub dibujar_matris_bloque(X As Long, Y As Long)
  536.  cuadrado_vacio Y, X, 24, 0, Picture1
  537.  cuadrado_vacio Y + 1, X + 1, 24, 0, Picture1
  538. End Sub
  539.  
  540. Public Sub pieza_siguiente()
  541.  pieza_sig = (Rnd(5) * 6) + 1
  542.  Picture2.Cls
  543.  Select Case pieza_sig
  544.  Case Is = 1
  545.   cuadrado_relleno 2, 2, 22, &HFF0000, Picture2
  546.   cuadrado_vacio 0, 0, 24, 0, Picture2
  547.   cuadrado_vacio 1, 1, 24, 0, Picture2
  548.   cuadrado_relleno 26, 2, 22, &HFF0000, Picture2
  549.   cuadrado_vacio 24, 0, 24, 0, Picture2
  550.   cuadrado_vacio 25, 1, 24, 0, Picture2
  551.   cuadrado_relleno 2, 26, 22, &HFF0000, Picture2
  552.   cuadrado_vacio 0, 24, 24, 0, Picture2
  553.   cuadrado_vacio 1, 25, 24, 0, Picture2
  554.   cuadrado_relleno 26, 26, 22, &HFF0000, Picture2
  555.   cuadrado_vacio 24, 24, 24, 0, Picture2
  556.   cuadrado_vacio 25, 25, 24, 0, Picture2
  557.  Case Is = 2
  558.   cuadrado_relleno 2, 2, 22, &HFF&, Picture2
  559.   cuadrado_vacio 0, 0, 24, 0, Picture2
  560.   cuadrado_vacio 1, 1, 24, 0, Picture2
  561.   cuadrado_relleno 2, 26, 22, &HFF&, Picture2
  562.   cuadrado_vacio 0, 24, 24, 0, Picture2
  563.   cuadrado_vacio 1, 25, 24, 0, Picture2
  564.   cuadrado_relleno 2, 50, 22, &HFF&, Picture2
  565.   cuadrado_vacio 0, 48, 24, 0, Picture2
  566.   cuadrado_vacio 1, 49, 24, 0, Picture2
  567.  Case Is = 3
  568.   cuadrado_relleno 2, 2, 22, &HFFFF&, Picture2
  569.   cuadrado_vacio 0, 0, 24, 0, Picture2
  570.   cuadrado_vacio 1, 1, 24, 0, Picture2
  571.   cuadrado_relleno 26, 2, 22, &HFFFF&, Picture2
  572.   cuadrado_vacio 24, 0, 24, 0, Picture2
  573.   cuadrado_vacio 25, 1, 24, 0, Picture2
  574.   cuadrado_relleno 50, 2, 22, &HFFFF&, Picture2
  575.   cuadrado_vacio 48, 0, 24, 0, Picture2
  576.   cuadrado_vacio 49, 1, 24, 0, Picture2
  577.   cuadrado_relleno 26, 26, 22, &HFFFF&, Picture2
  578.   cuadrado_vacio 24, 24, 24, 0, Picture2
  579.   cuadrado_vacio 25, 25, 24, 0, Picture2
  580.  Case Is = 4
  581.   cuadrado_relleno 2, 2, 22, &HFFFF00, Picture2
  582.   cuadrado_vacio 0, 0, 24, 0, Picture2
  583.   cuadrado_vacio 1, 1, 24, 0, Picture2
  584.   cuadrado_relleno 2, 26, 22, &HFFFF00, Picture2
  585.   cuadrado_vacio 0, 24, 24, 0, Picture2
  586.   cuadrado_vacio 1, 25, 24, 0, Picture2
  587.   cuadrado_relleno 2, 50, 22, &HFFFF00, Picture2
  588.   cuadrado_vacio 0, 48, 24, 0, Picture2
  589.   cuadrado_vacio 1, 49, 24, 0, Picture2
  590.   cuadrado_relleno 26, 2, 22, &HFFFF00, Picture2
  591.   cuadrado_vacio 24, 0, 24, 0, Picture2
  592.   cuadrado_vacio 25, 1, 24, 0, Picture2
  593.  Case Is = 5
  594.   cuadrado_relleno 2, 2, 22, &HFFFF00, Picture2
  595.   cuadrado_vacio 0, 0, 24, 0, Picture2
  596.   cuadrado_vacio 1, 1, 24, 0, Picture2
  597.   cuadrado_relleno 26, 2, 22, &HFFFF00, Picture2
  598.   cuadrado_vacio 24, 0, 24, 0, Picture2
  599.   cuadrado_vacio 25, 1, 24, 0, Picture2
  600.   cuadrado_relleno 26, 26, 22, &HFFFF00, Picture2
  601.   cuadrado_vacio 24, 24, 24, 0, Picture2
  602.   cuadrado_vacio 25, 25, 24, 0, Picture2
  603.   cuadrado_relleno 26, 50, 22, &HFFFF00, Picture2
  604.   cuadrado_vacio 24, 48, 24, 0, Picture2
  605.   cuadrado_vacio 25, 49, 24, 0, Picture2
  606.  Case Is = 6
  607.   cuadrado_relleno 2, 26, 22, &HC000&, Picture2
  608.   cuadrado_vacio 0, 24, 24, 0, Picture2
  609.   cuadrado_vacio 1, 25, 24, 0, Picture2
  610.   cuadrado_relleno 26, 26, 22, &HC000&, Picture2
  611.   cuadrado_vacio 24, 24, 24, 0, Picture2
  612.   cuadrado_vacio 25, 25, 24, 0, Picture2
  613.   cuadrado_relleno 26, 2, 22, &HC000&, Picture2
  614.   cuadrado_vacio 24, 0, 24, 0, Picture2
  615.   cuadrado_vacio 25, 1, 24, 0, Picture2
  616.   cuadrado_relleno 50, 2, 22, &HC000&, Picture2
  617.   cuadrado_vacio 48, 0, 24, 0, Picture2
  618.   cuadrado_vacio 49, 1, 24, 0, Picture2
  619.  Case Is = 7
  620.   cuadrado_relleno 2, 2, 22, &HC000&, Picture2
  621.   cuadrado_vacio 0, 0, 24, 0, Picture2
  622.   cuadrado_vacio 1, 1, 24, 0, Picture2
  623.   cuadrado_relleno 26, 2, 22, &HC000&, Picture2
  624.   cuadrado_vacio 24, 0, 24, 0, Picture2
  625.   cuadrado_vacio 25, 1, 24, 0, Picture2
  626.   cuadrado_relleno 26, 26, 22, &HC000&, Picture2
  627.   cuadrado_vacio 24, 24, 24, 0, Picture2
  628.   cuadrado_vacio 25, 25, 24, 0, Picture2
  629.   cuadrado_relleno 50, 26, 22, &HC000&, Picture2
  630.   cuadrado_vacio 48, 24, 24, 0, Picture2
  631.   cuadrado_vacio 49, 25, 24, 0, Picture2
  632.  End Select
  633. End Sub
  634.  
  635. Public Sub iniciar_pieza(tipo As Integer)
  636.  Dim mitad As Long
  637.  mitad = 4 * 24
  638.  piezas.visible = True
  639.  piezas.tipo = tipo
  640.  piezas.rot = 1
  641.  Select Case tipo
  642.  Case Is = 1
  643.   piezas.bloque1.visible = True
  644.   piezas.bloque1.X = mitad
  645.   piezas.bloque1.Y = 0
  646.   piezas.bloque2.visible = True
  647.   piezas.bloque2.X = 24 + mitad
  648.   piezas.bloque2.Y = 0
  649.   piezas.bloque3.visible = True
  650.   piezas.bloque3.X = mitad
  651.   piezas.bloque3.Y = 24
  652.   piezas.bloque4.visible = True
  653.   piezas.bloque4.X = 24 + mitad
  654.   piezas.bloque4.Y = 24
  655.   piezas.color = &HFF0000
  656.  Case Is = 2
  657.   piezas.bloque1.visible = True
  658.   piezas.bloque1.X = mitad
  659.   piezas.bloque1.Y = 0
  660.   piezas.bloque2.visible = True
  661.   piezas.bloque2.X = mitad
  662.   piezas.bloque2.Y = 24
  663.   piezas.bloque3.visible = True
  664.   piezas.bloque3.X = mitad
  665.   piezas.bloque3.Y = 48
  666.   piezas.bloque4.visible = False
  667.  piezas.color = &HFF&
  668.  Case Is = 3
  669.   piezas.bloque1.visible = True
  670.   piezas.bloque1.X = mitad
  671.   piezas.bloque1.Y = 0
  672.   piezas.bloque2.visible = True
  673.   piezas.bloque2.X = 24 + mitad
  674.   piezas.bloque2.Y = 0
  675.   piezas.bloque3.visible = True
  676.   piezas.bloque3.X = 48 + mitad
  677.   piezas.bloque3.Y = 0
  678.   piezas.bloque4.visible = True
  679.   piezas.bloque4.X = 24 + mitad
  680.   piezas.bloque4.Y = 24
  681.  piezas.color = &HFFFF&
  682.  Case Is = 4
  683.   piezas.bloque1.visible = True
  684.   piezas.bloque1.X = mitad
  685.   piezas.bloque1.Y = 0
  686.   piezas.bloque2.visible = True
  687.   piezas.bloque2.X = mitad
  688.   piezas.bloque2.Y = 24
  689.   piezas.bloque3.visible = True
  690.   piezas.bloque3.X = mitad
  691.   piezas.bloque3.Y = 48
  692.   piezas.bloque4.visible = True
  693.   piezas.bloque4.X = 24 + mitad
  694.   piezas.bloque4.Y = 0
  695.  piezas.color = &HFFFF00
  696.  Case Is = 5
  697.   piezas.bloque1.visible = True
  698.   piezas.bloque1.X = mitad
  699.   piezas.bloque1.Y = 0
  700.   piezas.bloque2.visible = True
  701.   piezas.bloque2.X = 24 + mitad
  702.   piezas.bloque2.Y = 0
  703.   piezas.bloque3.visible = True
  704.   piezas.bloque3.X = 24 + mitad
  705.   piezas.bloque3.Y = 24
  706.   piezas.bloque4.visible = True
  707.   piezas.bloque4.X = 24 + mitad
  708.   piezas.bloque4.Y = 48
  709.  piezas.color = &HFFFF00
  710.  Case Is = 6
  711.   piezas.bloque1.visible = True
  712.   piezas.bloque1.X = mitad
  713.   piezas.bloque1.Y = 24
  714.   piezas.bloque2.visible = True
  715.   piezas.bloque2.X = 24 + mitad
  716.   piezas.bloque2.Y = 24
  717.   piezas.bloque3.visible = True
  718.   piezas.bloque3.X = 24 + mitad
  719.   piezas.bloque3.Y = 0
  720.   piezas.bloque4.visible = True
  721.   piezas.bloque4.X = 48 + mitad
  722.   piezas.bloque4.Y = 0
  723.  piezas.color = &HC000&
  724.  Case Is = 7
  725.   piezas.bloque1.visible = True
  726.   piezas.bloque1.X = mitad
  727.   piezas.bloque1.Y = 0
  728.   piezas.bloque2.visible = True
  729.   piezas.bloque2.X = 24 + mitad
  730.   piezas.bloque2.Y = 0
  731.   piezas.bloque3.visible = True
  732.   piezas.bloque3.X = 24 + mitad
  733.   piezas.bloque3.Y = 24
  734.   piezas.bloque4.visible = True
  735.   piezas.bloque4.X = 48 + mitad
  736.   piezas.bloque4.Y = 24
  737.  piezas.color = &HC000&
  738.  End Select
  739.  dibujar_pieza
  740. End Sub
  741.  
  742. Public Sub rotar_pieza()
  743.  If detenido = True Then Exit Sub
  744.  borrar_pieza
  745.  Select Case piezas.tipo
  746.  Case Is = 2
  747.   If piezas.rot = 1 Then
  748.    piezas.rot = 2
  749.    piezas.bloque1.Y = piezas.bloque1.Y + 24
  750.    piezas.bloque1.X = piezas.bloque1.X - 24
  751.    piezas.bloque3.Y = piezas.bloque3.Y - 24
  752.    piezas.bloque3.X = piezas.bloque3.X + 24
  753.   Else
  754.    piezas.rot = 1
  755.    piezas.bloque1.Y = piezas.bloque1.Y - 24
  756.    piezas.bloque1.X = piezas.bloque1.X + 24
  757.    piezas.bloque3.Y = piezas.bloque3.Y + 24
  758.    piezas.bloque3.X = piezas.bloque3.X - 24
  759.   End If
  760.  Case Is = 3
  761.   Select Case piezas.rot
  762.   Case Is = 1
  763.    piezas.rot = 2
  764.    piezas.bloque1.Y = piezas.bloque1.Y - 24
  765.    piezas.bloque1.X = piezas.bloque1.X + 24
  766.    piezas.bloque3.Y = piezas.bloque3.Y + 24
  767.    piezas.bloque3.X = piezas.bloque3.X - 24
  768.    piezas.bloque4.Y = piezas.bloque4.Y - 24
  769.    piezas.bloque4.X = piezas.bloque4.X - 24
  770.   Case Is = 2
  771.    piezas.rot = 3
  772.    piezas.bloque1.Y = piezas.bloque1.Y + 24
  773.    piezas.bloque1.X = piezas.bloque1.X + 24
  774.    piezas.bloque3.Y = piezas.bloque3.Y - 24
  775.    piezas.bloque3.X = piezas.bloque3.X - 24
  776.    piezas.bloque4.Y = piezas.bloque4.Y - 24
  777.    piezas.bloque4.X = piezas.bloque4.X + 24
  778.   Case Is = 3
  779.    piezas.rot = 4
  780.    piezas.bloque1.Y = piezas.bloque1.Y + 24
  781.    piezas.bloque1.X = piezas.bloque1.X - 24
  782.    piezas.bloque3.Y = piezas.bloque3.Y - 24
  783.    piezas.bloque3.X = piezas.bloque3.X + 24
  784.    piezas.bloque4.Y = piezas.bloque4.Y + 24
  785.    piezas.bloque4.X = piezas.bloque4.X + 24
  786.   Case Is = 4
  787.    piezas.rot = 1
  788.    piezas.bloque1.Y = piezas.bloque1.Y - 24
  789.    piezas.bloque1.X = piezas.bloque1.X - 24
  790.    piezas.bloque3.Y = piezas.bloque3.Y + 24
  791.    piezas.bloque3.X = piezas.bloque3.X + 24
  792.    piezas.bloque4.Y = piezas.bloque4.Y + 24
  793.    piezas.bloque4.X = piezas.bloque4.X - 24
  794.   End Select
  795.  Case Is = 4
  796.   Select Case piezas.rot
  797.   Case Is = 1
  798.    piezas.rot = 2
  799.    piezas.bloque1.Y = piezas.bloque1.Y + 24
  800.    piezas.bloque1.X = piezas.bloque1.X + 24
  801.    piezas.bloque3.Y = piezas.bloque3.Y - 24
  802.    piezas.bloque3.X = piezas.bloque3.X - 24
  803.    piezas.bloque4.Y = piezas.bloque4.Y + 48
  804.   Case Is = 2
  805.    piezas.rot = 3
  806.    piezas.bloque1.Y = piezas.bloque1.Y + 24
  807.    piezas.bloque1.X = piezas.bloque1.X - 24
  808.    piezas.bloque3.Y = piezas.bloque3.Y - 24
  809.    piezas.bloque3.X = piezas.bloque3.X + 24
  810.    piezas.bloque4.X = piezas.bloque4.X - 48
  811.   Case Is = 3
  812.    piezas.rot = 4
  813.    piezas.bloque1.Y = piezas.bloque1.Y - 24
  814.    piezas.bloque1.X = piezas.bloque1.X - 24
  815.    piezas.bloque3.Y = piezas.bloque3.Y + 24
  816.    piezas.bloque3.X = piezas.bloque3.X + 24
  817.    piezas.bloque4.Y = piezas.bloque4.Y - 48
  818.   Case Is = 4
  819.    piezas.rot = 1
  820.    piezas.bloque1.Y = piezas.bloque1.Y - 24
  821.    piezas.bloque1.X = piezas.bloque1.X + 24
  822.    piezas.bloque3.Y = piezas.bloque3.Y + 24
  823.    piezas.bloque3.X = piezas.bloque3.X - 24
  824.    piezas.bloque4.X = piezas.bloque4.X + 48
  825.   End Select
  826.  Case Is = 5
  827.   Select Case piezas.rot
  828.   Case Is = 1
  829.    piezas.rot = 2
  830.    piezas.bloque1.X = piezas.bloque1.X + 48
  831.    piezas.bloque2.Y = piezas.bloque2.Y + 24
  832.    piezas.bloque2.X = piezas.bloque2.X + 24
  833.    piezas.bloque4.Y = piezas.bloque4.Y - 24
  834.    piezas.bloque4.X = piezas.bloque4.X - 24
  835.   Case Is = 2
  836.    piezas.rot = 3
  837.    piezas.bloque1.Y = piezas.bloque1.Y + 48
  838.    piezas.bloque2.Y = piezas.bloque2.Y + 24
  839.    piezas.bloque2.X = piezas.bloque2.X - 24
  840.    piezas.bloque4.Y = piezas.bloque4.Y - 24
  841.    piezas.bloque4.X = piezas.bloque4.X + 24
  842.   Case Is = 3
  843.    piezas.rot = 4
  844.    piezas.bloque1.X = piezas.bloque1.X - 48
  845.    piezas.bloque2.Y = piezas.bloque2.Y - 24
  846.    piezas.bloque2.X = piezas.bloque2.X - 24
  847.    piezas.bloque4.Y = piezas.bloque4.Y + 24
  848.    piezas.bloque4.X = piezas.bloque4.X + 24
  849.   Case Is = 4
  850.    piezas.rot = 1
  851.    piezas.bloque1.Y = piezas.bloque1.Y - 48
  852.    piezas.bloque2.Y = piezas.bloque2.Y - 24
  853.    piezas.bloque2.X = piezas.bloque2.X + 24
  854.    piezas.bloque4.Y = piezas.bloque4.Y + 24
  855.    piezas.bloque4.X = piezas.bloque4.X - 24
  856.   End Select
  857.  Case Is = 6
  858.   If piezas.rot = 1 Then
  859.    piezas.rot = 2
  860.    piezas.bloque1.Y = piezas.bloque1.Y - 24
  861.    piezas.bloque1.X = piezas.bloque1.X + 24
  862.    piezas.bloque3.Y = piezas.bloque3.Y + 24
  863.    piezas.bloque3.X = piezas.bloque3.X + 24
  864.    piezas.bloque4.Y = piezas.bloque4.Y + 48
  865.   Else
  866.    piezas.rot = 1
  867.    piezas.bloque1.Y = piezas.bloque1.Y + 24
  868.    piezas.bloque1.X = piezas.bloque1.X - 24
  869.    piezas.bloque3.Y = piezas.bloque3.Y - 24
  870.    piezas.bloque3.X = piezas.bloque3.X - 24
  871.    piezas.bloque4.Y = piezas.bloque4.Y - 48
  872.   End If
  873.  Case Is = 7
  874.   If piezas.rot = 1 Then
  875.    piezas.rot = 2
  876.    piezas.bloque1.X = piezas.bloque1.X + 48
  877.    piezas.bloque2.Y = piezas.bloque2.Y + 24
  878.    piezas.bloque2.X = piezas.bloque2.X + 24
  879.    piezas.bloque4.Y = piezas.bloque4.Y + 24
  880.    piezas.bloque4.X = piezas.bloque4.X - 24
  881.   Else
  882.    piezas.rot = 1
  883.    piezas.bloque1.X = piezas.bloque1.X - 48
  884.    piezas.bloque2.Y = piezas.bloque2.Y - 24
  885.    piezas.bloque2.X = piezas.bloque2.X - 24
  886.    piezas.bloque4.Y = piezas.bloque4.Y - 24
  887.    piezas.bloque4.X = piezas.bloque4.X + 24
  888.   End If
  889.  End Select
  890.  dibujar_pieza
  891. End Sub
  892.  
  893. Public Sub asentar_pieza()
  894.  If detenido = True Then Exit Sub
  895.  puntaje = puntaje + 10 + piezas.tipo
  896.  Label4.Caption = "Puntaje: " + Trim(Str(puntaje))
  897.  If piezas.bloque1.visible = True Then matris((piezas.bloque1.Y / 24), (piezas.bloque1.X / 24)) = piezas.tipo + 1
  898.  If piezas.bloque2.visible = True Then matris((piezas.bloque2.Y / 24), (piezas.bloque2.X / 24)) = piezas.tipo + 1
  899.  If piezas.bloque3.visible = True Then matris((piezas.bloque3.Y / 24), (piezas.bloque3.X / 24)) = piezas.tipo + 1
  900.  If piezas.bloque4.visible = True Then matris((piezas.bloque4.Y / 24), (piezas.bloque4.X / 24)) = piezas.tipo + 1
  901. End Sub
  902.  
  903. Public Sub dibujar_pieza()
  904.  If piezas.bloque1.visible = True Then dibujar_bloque 1
  905.  If piezas.bloque2.visible = True Then dibujar_bloque 2
  906.  If piezas.bloque3.visible = True Then dibujar_bloque 3
  907.  If piezas.bloque4.visible = True Then dibujar_bloque 4
  908. End Sub
  909.  
  910. Public Sub borrar_pieza()
  911.  If piezas.bloque1.visible = True Then borrar_bloque 1
  912.  If piezas.bloque2.visible = True Then borrar_bloque 2
  913.  If piezas.bloque3.visible = True Then borrar_bloque 3
  914.  If piezas.bloque4.visible = True Then borrar_bloque 4
  915. End Sub
  916.  
  917. Public Sub mover_pieza(dire As Integer)
  918.  If detenido = True Then Exit Sub
  919.  borrar_pieza
  920.  Select Case dire
  921.  Case Is = 1
  922.   If piezas.bloque1.visible = True Then piezas.bloque1.Y = piezas.bloque1.Y + 24
  923.   If piezas.bloque2.visible = True Then piezas.bloque2.Y = piezas.bloque2.Y + 24
  924.   If piezas.bloque3.visible = True Then piezas.bloque3.Y = piezas.bloque3.Y + 24
  925.   If piezas.bloque4.visible = True Then piezas.bloque4.Y = piezas.bloque4.Y + 24
  926.  Case Is = 2
  927.   If piezas.bloque1.visible = True Then piezas.bloque1.X = piezas.bloque1.X - 24
  928.   If piezas.bloque2.visible = True Then piezas.bloque2.X = piezas.bloque2.X - 24
  929.   If piezas.bloque3.visible = True Then piezas.bloque3.X = piezas.bloque3.X - 24
  930.   If piezas.bloque4.visible = True Then piezas.bloque4.X = piezas.bloque4.X - 24
  931.  Case Is = 3
  932.   If piezas.bloque1.visible = True Then piezas.bloque1.X = piezas.bloque1.X + 24
  933.   If piezas.bloque2.visible = True Then piezas.bloque2.X = piezas.bloque2.X + 24
  934.   If piezas.bloque3.visible = True Then piezas.bloque3.X = piezas.bloque3.X + 24
  935.   If piezas.bloque4.visible = True Then piezas.bloque4.X = piezas.bloque4.X + 24
  936.  End Select
  937.  dibujar_pieza
  938. End Sub
  939.  
  940. Public Sub dibujar_bloque(numero As Integer)
  941.  Select Case numero
  942.  Case Is = 1
  943.   cuadrado_relleno piezas.bloque1.X + 2, piezas.bloque1.Y + 2, 22, piezas.color, Picture1
  944.   cuadrado_vacio piezas.bloque1.X, piezas.bloque1.Y, 24, 0, Picture1
  945.   cuadrado_vacio piezas.bloque1.X + 1, piezas.bloque1.Y + 1, 24, 0, Picture1
  946.  Case Is = 2
  947.   cuadrado_relleno piezas.bloque2.X + 2, piezas.bloque2.Y + 2, 22, piezas.color, Picture1
  948.   cuadrado_vacio piezas.bloque2.X, piezas.bloque2.Y, 24, 0, Picture1
  949.   cuadrado_vacio piezas.bloque2.X + 1, piezas.bloque2.Y + 1, 24, 0, Picture1
  950.  Case Is = 3
  951.   cuadrado_relleno piezas.bloque3.X + 2, piezas.bloque3.Y + 2, 22, piezas.color, Picture1
  952.   cuadrado_vacio piezas.bloque3.X, piezas.bloque3.Y, 24, 0, Picture1
  953.   cuadrado_vacio piezas.bloque3.X + 1, piezas.bloque3.Y + 1, 24, 0, Picture1
  954.  Case Is = 4
  955.   cuadrado_relleno piezas.bloque4.X + 2, piezas.bloque4.Y + 2, 22, piezas.color, Picture1
  956.   cuadrado_vacio piezas.bloque4.X, piezas.bloque4.Y, 24, 0, Picture1
  957.   cuadrado_vacio piezas.bloque4.X + 1, piezas.bloque4.Y + 1, 24, 0, Picture1
  958.  End Select
  959. End Sub
  960.  
  961. Public Sub borrar_bloque(numero As Integer)
  962.  Select Case numero
  963.  Case Is = 1
  964.   cuadrado_relleno piezas.bloque1.X, piezas.bloque1.Y, 26, Picture1.BackColor, Picture1
  965.   If piezas.bloque1.Y > 0 Then
  966.    If matris((piezas.bloque1.Y / 24) - 1, (piezas.bloque1.X / 24) - 1) > 0 Then dibujar_matris_bloque piezas.bloque1.Y - 24, piezas.bloque1.X - 24
  967.    If matris((piezas.bloque1.Y / 24) - 1, piezas.bloque1.X / 24) > 0 Then dibujar_matris_bloque piezas.bloque1.Y - 24, piezas.bloque1.X
  968.    If matris((piezas.bloque1.Y / 24) - 1, (piezas.bloque1.X / 24) + 1) > 0 Then dibujar_matris_bloque piezas.bloque1.Y - 24, piezas.bloque1.X + 24
  969.   End If
  970.   If matris(piezas.bloque1.Y / 24, (piezas.bloque1.X / 24) + 1) > 0 Then dibujar_matris_bloque piezas.bloque1.Y, piezas.bloque1.X + 24
  971.   If matris((piezas.bloque1.Y / 24) + 1, (piezas.bloque1.X / 24) + 1) > 0 Then dibujar_matris_bloque piezas.bloque1.Y + 24, piezas.bloque1.X + 24
  972.   If matris((piezas.bloque1.Y / 24) + 1, piezas.bloque1.X / 24) > 0 Then dibujar_matris_bloque piezas.bloque1.Y + 24, piezas.bloque1.X
  973.   If matris((piezas.bloque1.Y / 24) + 1, (piezas.bloque1.X / 24) - 1) > 0 Then dibujar_matris_bloque piezas.bloque1.Y + 24, piezas.bloque1.X - 24
  974.   If matris(piezas.bloque1.Y / 24, (piezas.bloque1.X / 24) - 1) > 0 Then dibujar_matris_bloque piezas.bloque1.Y, piezas.bloque1.X - 24
  975.  Case Is = 2
  976.   cuadrado_relleno piezas.bloque2.X, piezas.bloque2.Y, 26, Picture1.BackColor, Picture1
  977.   If piezas.bloque2.Y > 0 Then
  978.    If matris((piezas.bloque2.Y / 24) - 1, (piezas.bloque2.X / 24) - 1) > 0 Then dibujar_matris_bloque piezas.bloque2.Y - 24, piezas.bloque2.X - 24
  979.    If matris((piezas.bloque2.Y / 24) - 1, piezas.bloque2.X / 24) > 0 Then dibujar_matris_bloque piezas.bloque2.Y - 24, piezas.bloque2.X
  980.    If matris((piezas.bloque2.Y / 24) - 1, (piezas.bloque2.X / 24) + 1) > 0 Then dibujar_matris_bloque piezas.bloque2.Y - 24, piezas.bloque2.X + 24
  981.   End If
  982.   If matris(piezas.bloque2.Y / 24, (piezas.bloque2.X / 24) + 1) > 0 Then dibujar_matris_bloque piezas.bloque2.Y, piezas.bloque2.X + 24
  983.   If matris((piezas.bloque2.Y / 24) + 1, (piezas.bloque2.X / 24) + 1) > 0 Then dibujar_matris_bloque piezas.bloque2.Y + 24, piezas.bloque2.X + 24
  984.   If matris((piezas.bloque2.Y / 24) + 1, piezas.bloque2.X / 24) > 0 Then dibujar_matris_bloque piezas.bloque2.Y + 24, piezas.bloque2.X
  985.   If matris((piezas.bloque2.Y / 24) + 1, (piezas.bloque2.X / 24) - 1) > 0 Then dibujar_matris_bloque piezas.bloque2.Y + 24, piezas.bloque2.X - 24
  986.   If matris(piezas.bloque2.Y / 24, (piezas.bloque2.X / 24) - 1) > 0 Then dibujar_matris_bloque piezas.bloque2.Y, piezas.bloque2.X - 24
  987.  Case Is = 3
  988.   cuadrado_relleno piezas.bloque3.X, piezas.bloque3.Y, 26, Picture1.BackColor, Picture1
  989.   If piezas.bloque3.Y > 0 Then
  990.    If matris((piezas.bloque3.Y / 24) - 1, (piezas.bloque3.X / 24) - 1) > 0 Then dibujar_matris_bloque piezas.bloque3.Y - 24, piezas.bloque3.X - 24
  991.    If matris((piezas.bloque3.Y / 24) - 1, piezas.bloque3.X / 24) > 0 Then dibujar_matris_bloque piezas.bloque3.Y - 24, piezas.bloque3.X
  992.    If matris((piezas.bloque3.Y / 24) - 1, (piezas.bloque3.X / 24) + 1) > 0 Then dibujar_matris_bloque piezas.bloque3.Y - 24, piezas.bloque3.X + 24
  993.   End If
  994.   If matris(piezas.bloque3.Y / 24, (piezas.bloque3.X / 24) + 1) > 0 Then dibujar_matris_bloque piezas.bloque3.Y, piezas.bloque3.X + 24
  995.   If matris((piezas.bloque3.Y / 24) + 1, (piezas.bloque3.X / 24) + 1) > 0 Then dibujar_matris_bloque piezas.bloque3.Y + 24, piezas.bloque3.X + 24
  996.   If matris((piezas.bloque3.Y / 24) + 1, piezas.bloque3.X / 24) > 0 Then dibujar_matris_bloque piezas.bloque3.Y + 24, piezas.bloque3.X
  997.   If matris((piezas.bloque3.Y / 24) + 1, (piezas.bloque3.X / 24) - 1) > 0 Then dibujar_matris_bloque piezas.bloque3.Y + 24, piezas.bloque3.X - 24
  998.   If matris(piezas.bloque3.Y / 24, (piezas.bloque3.X / 24) - 1) > 0 Then dibujar_matris_bloque piezas.bloque3.Y, piezas.bloque3.X - 24
  999.  Case Is = 4
  1000.   cuadrado_relleno piezas.bloque4.X, piezas.bloque4.Y, 26, Picture1.BackColor, Picture1
  1001.   If piezas.bloque4.Y > 0 Then
  1002.    If matris((piezas.bloque4.Y / 24) - 1, (piezas.bloque4.X / 24) - 1) > 0 Then dibujar_matris_bloque piezas.bloque4.Y - 24, piezas.bloque4.X - 24
  1003.    If matris((piezas.bloque4.Y / 24) - 1, piezas.bloque4.X / 24) > 0 Then dibujar_matris_bloque piezas.bloque4.Y - 24, piezas.bloque4.X
  1004.    If matris((piezas.bloque4.Y / 24) - 1, (piezas.bloque4.X / 24) + 1) > 0 Then dibujar_matris_bloque piezas.bloque4.Y - 24, piezas.bloque4.X + 24
  1005.   End If
  1006.   If matris(piezas.bloque4.Y / 24, (piezas.bloque4.X / 24) + 1) > 0 Then dibujar_matris_bloque piezas.bloque4.Y, piezas.bloque4.X + 24
  1007.   If matris((piezas.bloque4.Y / 24) + 1, (piezas.bloque4.X / 24) + 1) > 0 Then dibujar_matris_bloque piezas.bloque4.Y + 24, piezas.bloque4.X + 24
  1008.   If matris((piezas.bloque4.Y / 24) + 1, piezas.bloque4.X / 24) > 0 Then dibujar_matris_bloque piezas.bloque4.Y + 24, piezas.bloque4.X
  1009.   If matris((piezas.bloque4.Y / 24) + 1, (piezas.bloque4.X / 24) - 1) > 0 Then dibujar_matris_bloque piezas.bloque4.Y + 24, piezas.bloque4.X - 24
  1010.   If matris(piezas.bloque4.Y / 24, (piezas.bloque4.X / 24) - 1) > 0 Then dibujar_matris_bloque piezas.bloque4.Y, piezas.bloque4.X - 24
  1011.  End Select
  1012. End Sub
  1013.  
  1014. Private Sub Form_Load()
  1015.  Randomize
  1016.  Cargar_Scores
  1017.  detenido = False
  1018. End Sub
  1019.  
  1020. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  1021.  If Label7.ForeColor = &H80FF& Then Label7.ForeColor = &HFF0000
  1022. End Sub
  1023.  
  1024. Private Sub preparate()
  1025.  Dim sec As Integer
  1026.  Dim count As Integer
  1027.  Label1.Top = 223
  1028.  Label1.Left = 97
  1029.  Label1.visible = True
  1030.  Label5.Top = 248
  1031.  Label5.Left = 149
  1032.  Label5.Caption = "3"
  1033.  Label5.visible = True
  1034.  sec = Second(Time)
  1035.  count = 3
  1036.  Do While count > 0
  1037.   DoEvents
  1038.   Do While sec = Second(Time)
  1039.   Loop
  1040.   sec = Second(Time)
  1041.   count = count - 1
  1042.   Label5.Caption = Trim(Str(count))
  1043.  Loop
  1044.  Label1.visible = False
  1045.  Label1.Top = 7320
  1046.  Label1.Left = 7725
  1047.  Label5.visible = False
  1048.  Label5.Top = 7695
  1049.  Label5.Left = 8505
  1050.  detenido = False
  1051.  Timer1.Enabled = True
  1052. End Sub
  1053.  
  1054. Private Sub Image1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  1055.  If detenido = False Then
  1056.   modo = Index + 1
  1057.   Select Case modo
  1058.   Case Is = 1
  1059.    Label9.Caption = "Modo: Clasico"
  1060.   Case Is = 2
  1061.    Label9.Caption = "Modo: Rising"
  1062.   Case Is = 3
  1063.    Label9.Caption = "Modo: Strafe"
  1064.   Case Is = 4
  1065.    Label9.Caption = "Modo: Obstacles"
  1066.   End Select
  1067.   iniciar_juego
  1068.  End If
  1069. End Sub
  1070.  
  1071. Private Sub Label6_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  1072.  CURX = X
  1073.  CURY = Y
  1074. End Sub
  1075.  
  1076. Private Sub Label6_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  1077.   If Button = 1 Then Me.Move Me.Left + (X - CURX), Me.Top + (Y - CURY)
  1078. End Sub
  1079.  
  1080. Private Sub Label7_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  1081.  If Label1.visible = False Then
  1082.   Guardar_Scores
  1083.   creditos.Enabled = True
  1084.   creditos.visible = True
  1085.   Unload Form1
  1086.  End If
  1087. End Sub
  1088.  
  1089. Private Sub Label7_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  1090.  If Label7.ForeColor <> &H80FF& Then Label7.ForeColor = &H80FF&
  1091. End Sub
  1092.  
  1093. Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
  1094.  If Label1.visible = False Then
  1095.   Select Case KeyCode
  1096.   Case Is = vbKeyEscape
  1097.    Guardar_Scores
  1098.    creditos.Enabled = True
  1099.    creditos.visible = True
  1100.    Unload Form1
  1101.   Case Is = vbKeyDown
  1102.    If piezas.visible = True And detenido = False Then
  1103.     If colision_pieza(1) = False Then mover_pieza 1
  1104.    End If
  1105.   Case Is = vbKeyLeft
  1106.    If piezas.visible = True And detenido = False Then
  1107.     If colision_pieza(2) = False Then mover_pieza 2
  1108.    End If
  1109.   Case Is = vbKeyRight
  1110.    If piezas.visible = True And detenido = False Then
  1111.     If colision_pieza(3) = False Then mover_pieza 3
  1112.    End If
  1113.   Case Is = vbKeySpace
  1114.    If piezas.visible = True And detenido = False And piezas.tipo > 1 Then
  1115.     If colision_pieza(4) = False Then rotar_pieza
  1116.    End If
  1117.   Case Is = vbKeyP
  1118.    If Label1.visible = False Then
  1119.     If Label8.visible = False Then
  1120.      Label8.Top = 225
  1121.      Label8.Left = 126
  1122.      Label8.visible = True
  1123.      Timer1.Enabled = False
  1124.      detenido = True
  1125.     Else
  1126.      Label8.visible = False
  1127.      Label8.Top = 1000
  1128.      Label8.Left = 1000
  1129.      Timer1.Enabled = True
  1130.      detenido = False
  1131.     End If
  1132.    End If
  1133.   End Select
  1134.  End If
  1135. End Sub
  1136.  
  1137. Private Sub Timer1_Timer()
  1138.  If Label1.visible = False And detenido = False Then
  1139.  Text2.SetFocus
  1140.  If piezas.visible = True Then
  1141.   If colision_pieza(1) = True Then
  1142.    asentar_pieza
  1143.    check_lines
  1144.    If llego_arriba = True Then
  1145.     game_over
  1146.    Else
  1147.     If nivel = 1 And lineas > 10 Then
  1148.      nivel = 2
  1149.      Label2.Caption = "Nivel: 2"
  1150.      Timer1.Interval = 350
  1151.     Else
  1152.      If nivel = 2 And lineas > 20 Then
  1153.       nivel = 3
  1154.       Label2.Caption = "Nivel: 3"
  1155.       Timer1.Interval = 325
  1156.      Else
  1157.       If nivel = 3 And lineas > 30 Then
  1158.        nivel = 4
  1159.        Label2.Caption = "Nivel: 4"
  1160.        Timer1.Interval = 300
  1161.       Else
  1162.        If nivel = 4 And lineas > 40 Then
  1163.         nivel = 5
  1164.         Label2.Caption = "Nivel: 5"
  1165.         Timer1.Interval = 275
  1166.        Else
  1167.         If nivel = 5 And lineas > 50 Then
  1168.          nivel = 6
  1169.          Label2.Caption = "Nivel: 6"
  1170.          Timer1.Interval = 250
  1171.         Else
  1172.          If nivel = 6 And lineas > 60 Then
  1173.           nivel = 7
  1174.           Label2.Caption = "Nivel: 7"
  1175.           Timer1.Interval = 225
  1176.          Else
  1177.           If nivel = 7 And lineas > 70 Then
  1178.            nivel = 8
  1179.            Label2.Caption = "Nivel: 8"
  1180.            Timer1.Interval = 200
  1181.           Else
  1182.            If nivel = 8 And lineas > 80 Then
  1183.             nivel = 9
  1184.             Label2.Caption = "Nivel: 9"
  1185.             Timer1.Interval = 175
  1186.            Else
  1187.             If nivel = 9 And lineas > 90 Then
  1188.              nivel = 10
  1189.              Label2.Caption = "Nivel: 10"
  1190.              Timer1.Interval = 150
  1191.             Else
  1192.              If nivel = 10 And lineas > 100 Then
  1193.               ganaste
  1194.              End If
  1195.             End If
  1196.            End If
  1197.           End If
  1198.          End If
  1199.         End If
  1200.        End If
  1201.       End If
  1202.      End If
  1203.     End If
  1204.     iniciar_pieza pieza_sig
  1205.     pieza_siguiente
  1206.    End If
  1207.    If contador_piezas = 5 Then
  1208.     If modo > 1 And modo < 4 Then
  1209.      Label10.Top = 234
  1210.      Label10.Left = 117
  1211.      If modo = 2 Then
  1212.       Label9.Caption = "Modo: Rising"
  1213.       Label10.Caption = "Rising..."
  1214.       Label10.visible = True
  1215.       rise
  1216.      Else
  1217.       If modo = 3 Then
  1218.        Label9.Caption = "Modo: Strafe"
  1219.        Label10.Caption = "Strafing..."
  1220.        Label10.visible = True
  1221.        strafe
  1222.       End If
  1223.      End If
  1224.      Label10.visible = False
  1225.      Label10.Top = 6000
  1226.      Label10.Left = 6000
  1227.     End If
  1228.     contador_piezas = 0
  1229.    Else
  1230.     contador_piezas = contador_piezas + 1
  1231.     If modo = 2 Then
  1232.      Label9.Caption = "Modo: Rising " + Trim(Str(5 - contador_piezas))
  1233.     Else
  1234.      If modo = 3 Then
  1235.       Label9.Caption = "Modo: Strafe " + Trim(Str(5 - contador_piezas))
  1236.      End If
  1237.     End If
  1238.    End If
  1239.   Else
  1240.    mover_pieza 1
  1241.   End If
  1242.  End If
  1243.  End If
  1244. End Sub
  1245.  
  1246. Private Function colision_pieza(mov As Integer) As Boolean
  1247.  If detenido = True Then Exit Function
  1248.  Select Case piezas.tipo
  1249.  Case Is = 1
  1250.   If col1(mov) = True Then
  1251.    colision_pieza = True
  1252.   Else
  1253.    colision_pieza = False
  1254.   End If
  1255.  Case Is = 2
  1256.   If col2(mov) = True Then
  1257.    colision_pieza = True
  1258.   Else
  1259.    colision_pieza = False
  1260.   End If
  1261.  Case Is = 3
  1262.   If col3(mov) = True Then
  1263.    colision_pieza = True
  1264.   Else
  1265.    colision_pieza = False
  1266.   End If
  1267.  Case Is = 4
  1268.   If col4(mov) = True Then
  1269.    colision_pieza = True
  1270.   Else
  1271.    colision_pieza = False
  1272.   End If
  1273.  Case Is = 5
  1274.   If col5(mov) = True Then
  1275.    colision_pieza = True
  1276.   Else
  1277.    colision_pieza = False
  1278.   End If
  1279.  Case Is = 6
  1280.   If col6(mov) = True Then
  1281.    colision_pieza = True
  1282.   Else
  1283.    colision_pieza = False
  1284.   End If
  1285.  Case Is = 7
  1286.   If col7(mov) = True Then
  1287.    colision_pieza = True
  1288.   Else
  1289.    colision_pieza = False
  1290.   End If
  1291.  End Select
  1292. End Function
  1293.  
  1294. Private Function col1(mov As Integer) As Boolean
  1295.  Dim ubi1_x As Integer
  1296.  Dim ubi1_y As Integer
  1297.  Dim ubi2_x As Integer
  1298.  Dim ubi2_y As Integer
  1299.  Dim ubi3_x As Integer
  1300.  Dim ubi3_y As Integer
  1301.  Dim ubi4_x As Integer
  1302.  Dim ubi4_y As Integer
  1303.  If detenido = True Then Exit Function
  1304.  ubi1_x = (piezas.bloque1.X / 24)
  1305.  ubi1_y = (piezas.bloque1.Y / 24)
  1306.  ubi2_x = (piezas.bloque2.X / 24)
  1307.  ubi2_y = (piezas.bloque2.Y / 24)
  1308.  ubi3_x = (piezas.bloque3.X / 24)
  1309.  ubi3_y = (piezas.bloque3.Y / 24)
  1310.  ubi4_x = (piezas.bloque4.X / 24)
  1311.  ubi4_y = (piezas.bloque4.Y / 24)
  1312.  Select Case mov
  1313.  Case Is = 1 'abajo
  1314.   If matris(ubi3_y + 1, ubi3_x) = 0 And matris(ubi4_y + 1, ubi4_x) = 0 Then
  1315.    col1 = False
  1316.   Else
  1317.    col1 = True
  1318.   End If
  1319.  Case Is = 2 'iz
  1320.   If matris(ubi1_y, ubi1_x - 1) = 0 And matris(ubi3_y, ubi3_x - 1) = 0 Then
  1321.    col1 = False
  1322.   Else
  1323.    col1 = True
  1324.   End If
  1325.  Case Is = 3 'der
  1326.   If matris(ubi2_y, ubi2_x + 1) = 0 And matris(ubi4_y, ubi4_x + 1) = 0 Then
  1327.    col1 = False
  1328.   Else
  1329.    col1 = True
  1330.   End If
  1331.  End Select
  1332. End Function
  1333.  
  1334. Private Function col2(mov As Integer) As Boolean
  1335.  Dim ubi1_x As Integer
  1336.  Dim ubi1_y As Integer
  1337.  Dim ubi2_x As Integer
  1338.  Dim ubi2_y As Integer
  1339.  Dim ubi3_x As Integer
  1340.  Dim ubi3_y As Integer
  1341.  If detenido = True Then Exit Function
  1342.  ubi1_x = (piezas.bloque1.X / 24)
  1343.  ubi1_y = (piezas.bloque1.Y / 24)
  1344.  ubi2_x = (piezas.bloque2.X / 24)
  1345.  ubi2_y = (piezas.bloque2.Y / 24)
  1346.  ubi3_x = (piezas.bloque3.X / 24)
  1347.  ubi3_y = (piezas.bloque3.Y / 24)
  1348.   If piezas.rot = 1 Then
  1349.    Select Case mov
  1350.    Case Is = 1
  1351.     If matris(ubi3_y + 1, ubi3_x) = 0 Then
  1352.      col2 = False
  1353.     Else
  1354.      col2 = True
  1355.     End If
  1356.    Case Is = 2
  1357.     If matris(ubi1_y, ubi1_x - 1) = 0 And matris(ubi2_y, ubi2_x - 1) = 0 And matris(ubi3_y, ubi3_x - 1) = 0 Then
  1358.      col2 = False
  1359.     Else
  1360.      col2 = True
  1361.     End If
  1362.    Case Is = 3
  1363.     If matris(ubi1_y, ubi1_x + 1) = 0 And matris(ubi2_y, ubi2_x + 1) = 0 And matris(ubi3_y, ubi3_x + 1) = 0 Then
  1364.      col2 = False
  1365.     Else
  1366.      col2 = True
  1367.     End If
  1368.    Case Is = 4
  1369.     If matris(ubi1_y + 1, ubi1_x - 1) = 0 And matris(ubi3_y - 1, ubi3_x + 1) = 0 Then
  1370.      col2 = False
  1371.     Else
  1372.      col2 = True
  1373.     End If
  1374.    End Select
  1375.   Else
  1376.    Select Case mov
  1377.    Case Is = 1
  1378.     If matris(ubi1_y + 1, ubi1_x) = 0 And matris(ubi2_y + 1, ubi2_x) = 0 And matris(ubi3_y + 1, ubi3_x) = 0 Then
  1379.      col2 = False
  1380.     Else
  1381.      col2 = True
  1382.     End If
  1383.    Case Is = 2
  1384.     If matris(ubi1_y, ubi1_x - 1) = 0 Then
  1385.      col2 = False
  1386.     Else
  1387.      col2 = True
  1388.     End If
  1389.    Case Is = 3
  1390.     If matris(ubi3_y, ubi3_x + 1) = 0 Then
  1391.      col2 = False
  1392.     Else
  1393.      col2 = True
  1394.     End If
  1395.    Case Is = 4
  1396.     If ubi1_y > 0 Then
  1397.      If matris(ubi1_y - 1, ubi1_x + 1) = 0 And matris(ubi3_y + 1, ubi3_x - 1) = 0 Then
  1398.       col2 = False
  1399.      Else
  1400.       col2 = True
  1401.      End If
  1402.     Else
  1403.      col2 = True
  1404.     End If
  1405.    End Select
  1406.   End If
  1407. End Function
  1408.  
  1409. Private Function col3(mov As Integer) As Boolean
  1410.  Dim ubi1_x As Integer
  1411.  Dim ubi1_y As Integer
  1412.  Dim ubi2_x As Integer
  1413.  Dim ubi2_y As Integer
  1414.  Dim ubi3_x As Integer
  1415.  Dim ubi3_y As Integer
  1416.  Dim ubi4_x As Integer
  1417.  Dim ubi4_y As Integer
  1418.  If detenido = True Then Exit Function
  1419.  ubi1_x = (piezas.bloque1.X / 24)
  1420.  ubi1_y = (piezas.bloque1.Y / 24)
  1421.  ubi2_x = (piezas.bloque2.X / 24)
  1422.  ubi2_y = (piezas.bloque2.Y / 24)
  1423.  ubi3_x = (piezas.bloque3.X / 24)
  1424.  ubi3_y = (piezas.bloque3.Y / 24)
  1425.  ubi4_x = (piezas.bloque4.X / 24)
  1426.  ubi4_y = (piezas.bloque4.Y / 24)
  1427.   Select Case piezas.rot
  1428.   Case Is = 1
  1429.    Select Case mov
  1430.    Case Is = 1
  1431.     If matris(ubi1_y + 1, ubi1_x) = 0 And matris(ubi4_y + 1, ubi4_x) = 0 And matris(ubi3_y + 1, ubi3_x) = 0 Then
  1432.      col3 = False
  1433.     Else
  1434.      col3 = True
  1435.     End If
  1436.    Case Is = 2
  1437.     If matris(ubi1_y, ubi1_x - 1) = 0 And matris(ubi4_y, ubi4_x - 1) = 0 Then
  1438.      col3 = False
  1439.     Else
  1440.      col3 = True
  1441.     End If
  1442.    Case Is = 3
  1443.     If matris(ubi3_y, ubi3_x + 1) = 0 And matris(ubi4_y, ubi4_x + 1) = 0 Then
  1444.      col3 = False
  1445.     Else
  1446.      col3 = True
  1447.     End If
  1448.    Case Is = 4 'rotacion
  1449.     If ubi1_y > 0 Then
  1450.      If matris(ubi1_y - 1, ubi1_x + 1) = 0 And matris(ubi3_y + 1, ubi3_x - 1) = 0 And matris(ubi4_y - 1, ubi4_x - 1) = 0 Then
  1451.       col3 = False
  1452.      Else
  1453.       col3 = True
  1454.      End If
  1455.     Else
  1456.      col3 = True
  1457.     End If
  1458.    End Select
  1459.   Case Is = 2
  1460.    Select Case mov
  1461.    Case Is = 1
  1462.     If matris(ubi3_y + 1, ubi3_x) = 0 And matris(ubi4_y + 1, ubi4_x) = 0 Then
  1463.      col3 = False
  1464.     Else
  1465.      col3 = True
  1466.     End If
  1467.    Case Is = 2
  1468.     If matris(ubi1_y, ubi1_x - 1) = 0 And matris(ubi4_y, ubi4_x - 1) = 0 And matris(ubi3_y, ubi3_x - 1) = 0 Then
  1469.      col3 = False
  1470.     Else
  1471.      col3 = True
  1472.     End If
  1473.    Case Is = 3
  1474.     If matris(ubi1_y, ubi1_x + 1) = 0 And matris(ubi2_y, ubi2_x + 1) = 0 And matris(ubi3_y, ubi3_x + 1) = 0 Then
  1475.      col3 = False
  1476.     Else
  1477.      col3 = True
  1478.     End If
  1479.    Case Is = 4 'rotacion
  1480.      If matris(ubi1_y + 1, ubi1_x + 1) = 0 And matris(ubi3_y - 1, ubi3_x - 1) = 0 And matris(ubi4_y - 1, ubi4_x + 1) = 0 Then
  1481.       col3 = False
  1482.      Else
  1483.       col3 = True
  1484.      End If
  1485.    End Select
  1486.   Case Is = 3
  1487.    Select Case mov
  1488.    Case Is = 1
  1489.     If matris(ubi1_y + 1, ubi1_x) = 0 And matris(ubi2_y + 1, ubi2_x) = 0 And matris(ubi3_y + 1, ubi3_x) = 0 Then
  1490.      col3 = False
  1491.     Else
  1492.      col3 = True
  1493.     End If
  1494.    Case Is = 2
  1495.     If matris(ubi3_y, ubi3_x - 1) = 0 And matris(ubi4_y, ubi4_x - 1) = 0 Then
  1496.      col3 = False
  1497.     Else
  1498.      col3 = True
  1499.     End If
  1500.    Case Is = 3
  1501.     If matris(ubi1_y, ubi1_x + 1) = 0 And matris(ubi4_y, ubi4_x + 1) = 0 Then
  1502.      col3 = False
  1503.     Else
  1504.      col3 = True
  1505.     End If
  1506.    Case Is = 4 'rotacion
  1507.     If ubi4_y > 0 Then
  1508.      If matris(ubi1_y + 1, ubi1_x - 1) = 0 And matris(ubi3_y - 1, ubi3_x + 1) = 0 And matris(ubi4_y + 1, ubi4_x + 1) = 0 Then
  1509.       col3 = False
  1510.      Else
  1511.       col3 = True
  1512.      End If
  1513.     Else
  1514.      col3 = True
  1515.     End If
  1516.    End Select
  1517.   Case Is = 4
  1518.    Select Case mov
  1519.    Case Is = 1
  1520.     If matris(ubi1_y + 1, ubi1_x) = 0 And matris(ubi4_y + 1, ubi4_x) = 0 Then
  1521.      col3 = False
  1522.     Else
  1523.      col3 = True
  1524.     End If
  1525.    Case Is = 2
  1526.     If matris(ubi1_y, ubi1_x - 1) = 0 And matris(ubi2_y, ubi2_x - 1) = 0 And matris(ubi3_y, ubi3_x - 1) = 0 Then
  1527.      col3 = False
  1528.     Else
  1529.      col3 = True
  1530.     End If
  1531.    Case Is = 3
  1532.     If matris(ubi1_y, ubi1_x + 1) = 0 And matris(ubi3_y, ubi3_x + 1) = 0 And matris(ubi4_y, ubi4_x + 1) = 0 Then
  1533.      col3 = False
  1534.     Else
  1535.      col3 = True
  1536.     End If
  1537.    Case Is = 4 'rotacion
  1538.     If matris(ubi1_y - 1, ubi1_x - 1) = 0 And matris(ubi3_y + 1, ubi3_x + 1) = 0 And matris(ubi4_y + 1, ubi4_x - 1) = 0 Then
  1539.      col3 = False
  1540.     Else
  1541.      col3 = True
  1542.     End If
  1543.    End Select
  1544.   End Select
  1545. End Function
  1546.  
  1547. Private Function col4(mov As Integer) As Boolean
  1548.  Dim ubi1_x As Integer
  1549.  Dim ubi1_y As Integer
  1550.  Dim ubi2_x As Integer
  1551.  Dim ubi2_y As Integer
  1552.  Dim ubi3_x As Integer
  1553.  Dim ubi3_y As Integer
  1554.  Dim ubi4_x As Integer
  1555.  Dim ubi4_y As Integer
  1556.  If detenido = True Then Exit Function
  1557.  ubi1_x = (piezas.bloque1.X / 24)
  1558.  ubi1_y = (piezas.bloque1.Y / 24)
  1559.  ubi2_x = (piezas.bloque2.X / 24)
  1560.  ubi2_y = (piezas.bloque2.Y / 24)
  1561.  ubi3_x = (piezas.bloque3.X / 24)
  1562.  ubi3_y = (piezas.bloque3.Y / 24)
  1563.  ubi4_x = (piezas.bloque4.X / 24)
  1564.  ubi4_y = (piezas.bloque4.Y / 24)
  1565.   Select Case piezas.rot
  1566.   Case Is = 1
  1567.    Select Case mov
  1568.    Case Is = 1
  1569.     If matris(ubi3_y + 1, ubi3_x) = 0 And matris(ubi4_y + 1, ubi4_x) = 0 Then
  1570.      col4 = False
  1571.     Else
  1572.      col4 = True
  1573.     End If
  1574.    Case Is = 2
  1575.     If matris(ubi1_y, ubi1_x - 1) = 0 And matris(ubi2_y, ubi2_x - 1) = 0 And matris(ubi3_y, ubi3_x - 1) = 0 Then
  1576.      col4 = False
  1577.     Else
  1578.      col4 = True
  1579.     End If
  1580.    Case Is = 3
  1581.     If matris(ubi2_y, ubi2_x + 1) = 0 And matris(ubi3_y, ubi3_x + 1) = 0 And matris(ubi4_y, ubi4_x + 1) = 0 Then
  1582.      col4 = False
  1583.     Else
  1584.      col4 = True
  1585.     End If
  1586.    Case Is = 4 'rotacion
  1587.     If matris(ubi1_y + 1, ubi1_x + 1) = 0 And matris(ubi3_y - 1, ubi3_x - 1) = 0 And matris(ubi4_y + 2, ubi4_x) = 0 Then
  1588.      col4 = False
  1589.     Else
  1590.      col4 = True
  1591.     End If
  1592.    End Select
  1593.   Case Is = 2
  1594.    Select Case mov
  1595.    Case Is = 1
  1596.     If matris(ubi2_y + 1, ubi2_x) = 0 And matris(ubi3_y + 1, ubi3_x) = 0 And matris(ubi4_y + 1, ubi4_x) = 0 Then
  1597.      col4 = False
  1598.     Else
  1599.      col4 = True
  1600.     End If
  1601.    Case Is = 2
  1602.     If matris(ubi3_y, ubi3_x - 1) = 0 And matris(ubi4_y, ubi4_x - 1) = 0 Then
  1603.      col4 = False
  1604.     Else
  1605.      col4 = True
  1606.     End If
  1607.    Case Is = 3
  1608.     If matris(ubi1_y, ubi1_x + 1) = 0 And matris(ubi4_y, ubi4_x + 1) = 0 Then
  1609.      col4 = False
  1610.     Else
  1611.      col4 = True
  1612.     End If
  1613.    Case Is = 4 'rotacion
  1614.     If ubi3_y > 0 Then
  1615.      If matris(ubi1_y + 1, ubi1_x - 1) = 0 And matris(ubi3_y - 1, ubi3_x + 1) = 0 And matris(ubi4_y, ubi4_x - 2) = 0 Then
  1616.       col4 = False
  1617.      Else
  1618.       col4 = True
  1619.      End If
  1620.     Else
  1621.      col4 = True
  1622.     End If
  1623.    End Select
  1624.   Case Is = 3
  1625.    Select Case mov
  1626.    Case Is = 1
  1627.     If matris(ubi1_y + 1, ubi1_x) = 0 And matris(ubi4_y + 1, ubi4_x) = 0 Then
  1628.      col4 = False
  1629.     Else
  1630.      col4 = True
  1631.     End If
  1632.    Case Is = 2
  1633.     If matris(ubi2_y, ubi2_x - 1) = 0 And matris(ubi3_y, ubi3_x - 1) = 0 And matris(ubi4_y, ubi4_x - 1) = 0 Then
  1634.      col4 = False
  1635.     Else
  1636.      col4 = True
  1637.     End If
  1638.    Case Is = 3
  1639.     If matris(ubi1_y, ubi1_x + 1) = 0 And matris(ubi2_y, ubi2_x + 1) = 0 And matris(ubi3_y, ubi3_x + 1) = 0 Then
  1640.      col4 = False
  1641.     Else
  1642.      col4 = True
  1643.     End If
  1644.    Case Is = 4 'rotacion
  1645.     If matris(ubi1_y - 1, ubi1_x - 1) = 0 And matris(ubi3_y + 1, ubi3_x + 1) = 0 And matris(ubi4_y - 2, ubi4_x) = 0 Then
  1646.      col4 = False
  1647.     Else
  1648.      col4 = True
  1649.     End If
  1650.    End Select
  1651.   Case Is = 4
  1652.    Select Case mov
  1653.    Case Is = 1
  1654.     If matris(ubi1_y + 1, ubi1_x) = 0 And matris(ubi2_y + 1, ubi2_x) = 0 And matris(ubi3_y + 1, ubi3_x) = 0 Then
  1655.      col4 = False
  1656.     Else
  1657.      col4 = True
  1658.     End If
  1659.    Case Is = 2
  1660.     If matris(ubi1_y, ubi1_x - 1) = 0 And matris(ubi4_y, ubi4_x - 1) = 0 Then
  1661.      col4 = False
  1662.     Else
  1663.      col4 = True
  1664.     End If
  1665.    Case Is = 3
  1666.     If matris(ubi3_y, ubi3_x + 1) = 0 And matris(ubi4_y, ubi4_x + 1) = 0 Then
  1667.      col4 = False
  1668.     Else
  1669.      col4 = True
  1670.     End If
  1671.    Case Is = 4 'rotacion
  1672.     If ubi4_y > 0 Then
  1673.      If matris(ubi1_y - 1, ubi1_x + 1) = 0 And matris(ubi3_y + 1, ubi3_x - 1) = 0 And matris(ubi4_y, ubi4_x + 2) = 0 Then
  1674.       col4 = False
  1675.      Else
  1676.       col4 = True
  1677.      End If
  1678.     Else
  1679.      col4 = True
  1680.     End If
  1681.    End Select
  1682.   End Select
  1683. End Function
  1684.  
  1685. Private Function col5(mov As Integer) As Boolean
  1686.  Dim ubi1_x As Integer
  1687.  Dim ubi1_y As Integer
  1688.  Dim ubi2_x As Integer
  1689.  Dim ubi2_y As Integer
  1690.  Dim ubi3_x As Integer
  1691.  Dim ubi3_y As Integer
  1692.  Dim ubi4_x As Integer
  1693.  Dim ubi4_y As Integer
  1694.  ubi1_x = (piezas.bloque1.X / 24)
  1695.  ubi1_y = (piezas.bloque1.Y / 24)
  1696.  ubi2_x = (piezas.bloque2.X / 24)
  1697.  ubi2_y = (piezas.bloque2.Y / 24)
  1698.  ubi3_x = (piezas.bloque3.X / 24)
  1699.  ubi3_y = (piezas.bloque3.Y / 24)
  1700.  ubi4_x = (piezas.bloque4.X / 24)
  1701.  ubi4_y = (piezas.bloque4.Y / 24)
  1702.  If detenido = True Then Exit Function
  1703.   Select Case piezas.rot
  1704.   Case Is = 1
  1705.    Select Case mov
  1706.    Case Is = 1
  1707.     If matris(ubi1_y + 1, ubi1_x) = 0 And matris(ubi4_y + 1, ubi4_x) = 0 Then
  1708.      col5 = False
  1709.     Else
  1710.      col5 = True
  1711.     End If
  1712.    Case Is = 2
  1713.     If matris(ubi1_y, ubi1_x - 1) = 0 And matris(ubi3_y, ubi3_x - 1) = 0 And matris(ubi4_y, ubi4_x - 1) = 0 Then
  1714.      col5 = False
  1715.     Else
  1716.      col5 = True
  1717.     End If
  1718.    Case Is = 3
  1719.     If matris(ubi2_y, ubi2_x + 1) = 0 And matris(ubi3_y, ubi3_x + 1) = 0 And matris(ubi4_y, ubi4_x + 1) = 0 Then
  1720.      col5 = False
  1721.     Else
  1722.      col5 = True
  1723.     End If
  1724.    Case Is = 4 'rotacion
  1725.     If matris(ubi1_y, ubi1_x + 2) = 0 And matris(ubi2_y + 1, ubi2_x + 1) = 0 And matris(ubi4_y - 1, ubi4_x - 1) = 0 Then
  1726.      col5 = False
  1727.     Else
  1728.      col5 = True
  1729.     End If
  1730.    End Select
  1731.   Case Is = 2
  1732.    Select Case mov
  1733.    Case Is = 1
  1734.     If matris(ubi2_y + 1, ubi2_x) = 0 And matris(ubi3_y + 1, ubi3_x) = 0 And matris(ubi4_y + 1, ubi4_x) = 0 Then
  1735.      col5 = False
  1736.     Else
  1737.      col5 = True
  1738.     End If
  1739.    Case Is = 2
  1740.     If matris(ubi1_y, ubi1_x - 1) = 0 And matris(ubi4_y, ubi4_x - 1) = 0 Then
  1741.      col5 = False
  1742.     Else
  1743.      col5 = True
  1744.     End If
  1745.    Case Is = 3
  1746.     If matris(ubi1_y, ubi1_x + 1) = 0 And matris(ubi2_y, ubi2_x + 1) = 0 Then
  1747.      col5 = False
  1748.     Else
  1749.      col5 = True
  1750.     End If
  1751.    Case Is = 4 'rotacion
  1752.     If ubi1_y > 0 Then
  1753.      If matris(ubi1_y + 2, ubi1_x) = 0 And matris(ubi2_y + 1, ubi2_x - 1) = 0 And matris(ubi4_y - 1, ubi4_x + 1) = 0 Then
  1754.       col5 = False
  1755.      Else
  1756.       col5 = True
  1757.      End If
  1758.     Else
  1759.      col5 = True
  1760.     End If
  1761.    End Select
  1762.   Case Is = 3
  1763.    Select Case mov
  1764.    Case Is = 1
  1765.     If matris(ubi1_y + 1, ubi1_x) = 0 And matris(ubi2_y + 1, ubi2_x) = 0 Then
  1766.      col5 = False
  1767.     Else
  1768.      col5 = True
  1769.     End If
  1770.    Case Is = 2
  1771.     If matris(ubi2_y, ubi2_x - 1) = 0 And matris(ubi3_y, ubi3_x - 1) = 0 And matris(ubi4_y, ubi4_x - 1) = 0 Then
  1772.      col5 = False
  1773.     Else
  1774.      col5 = True
  1775.     End If
  1776.    Case Is = 3
  1777.     If matris(ubi1_y, ubi1_x + 1) = 0 And matris(ubi3_y, ubi3_x + 1) = 0 And matris(ubi4_y, ubi4_x + 1) = 0 Then
  1778.      col5 = False
  1779.     Else
  1780.      col5 = True
  1781.     End If
  1782.    Case Is = 4 'rotacion
  1783.     If matris(ubi1_y, ubi1_x - 2) = 0 And matris(ubi2_y - 1, ubi2_x - 1) = 0 And matris(ubi4_y + 1, ubi4_x + 1) = 0 Then
  1784.      col5 = False
  1785.     Else
  1786.      col5 = True
  1787.     End If
  1788.    End Select
  1789.   Case Is = 4
  1790.    Select Case mov
  1791.    Case Is = 1
  1792.     If matris(ubi1_y + 1, ubi1_x) = 0 And matris(ubi3_y + 1, ubi3_x) = 0 And matris(ubi4_y + 1, ubi4_x) = 0 Then
  1793.      col5 = False
  1794.     Else
  1795.      col5 = True
  1796.     End If
  1797.    Case Is = 2
  1798.     If matris(ubi1_y, ubi1_x - 1) = 0 And matris(ubi2_y, ubi2_x - 1) = 0 Then
  1799.      col5 = False
  1800.     Else
  1801.      col5 = True
  1802.     End If
  1803.    Case Is = 3
  1804.     If matris(ubi1_y, ubi1_x + 1) = 0 And matris(ubi4_y, ubi4_x + 1) = 0 Then
  1805.      col5 = False
  1806.     Else
  1807.      col5 = True
  1808.     End If
  1809.    Case Is = 4 'rotacion
  1810.     If ubi4_y > 0 Then
  1811.      If matris(ubi1_y - 2, ubi1_x) = 0 And matris(ubi2_y - 1, ubi2_x + 1) = 0 And matris(ubi4_y + 1, ubi4_x - 1) = 0 Then
  1812.       col5 = False
  1813.      Else
  1814.       col5 = True
  1815.      End If
  1816.     Else
  1817.      col5 = True
  1818.     End If
  1819.    End Select
  1820.   End Select
  1821. End Function
  1822.  
  1823. Private Function col6(mov As Integer) As Boolean
  1824.  Dim ubi1_x As Integer
  1825.  Dim ubi1_y As Integer
  1826.  Dim ubi2_x As Integer
  1827.  Dim ubi2_y As Integer
  1828.  Dim ubi3_x As Integer
  1829.  Dim ubi3_y As Integer
  1830.  Dim ubi4_x As Integer
  1831.  Dim ubi4_y As Integer
  1832.  If detenido = True Then Exit Function
  1833.  ubi1_x = (piezas.bloque1.X / 24)
  1834.  ubi1_y = (piezas.bloque1.Y / 24)
  1835.  ubi2_x = (piezas.bloque2.X / 24)
  1836.  ubi2_y = (piezas.bloque2.Y / 24)
  1837.  ubi3_x = (piezas.bloque3.X / 24)
  1838.  ubi3_y = (piezas.bloque3.Y / 24)
  1839.  ubi4_x = (piezas.bloque4.X / 24)
  1840.  ubi4_y = (piezas.bloque4.Y / 24)
  1841.   If piezas.rot = 1 Then
  1842.    Select Case mov
  1843.    Case Is = 1
  1844.     If matris(ubi1_y + 1, ubi1_x) = 0 And matris(ubi2_y + 1, ubi2_x) = 0 And matris(ubi4_y + 1, ubi4_x) = 0 Then
  1845.      col6 = False
  1846.     Else
  1847.      col6 = True
  1848.     End If
  1849.    Case Is = 2
  1850.     If matris(ubi1_y, ubi1_x - 1) = 0 And matris(ubi3_y, ubi3_x - 1) = 0 Then
  1851.      col6 = False
  1852.     Else
  1853.      col6 = True
  1854.     End If
  1855.    Case Is = 3
  1856.     If matris(ubi2_y, ubi2_x + 1) = 0 And matris(ubi4_y, ubi4_x + 1) = 0 Then
  1857.      col6 = False
  1858.     Else
  1859.      col6 = True
  1860.     End If
  1861.    Case Is = 4 'rotacion
  1862.      If matris(ubi1_y - 1, ubi1_x + 1) = 0 And matris(ubi3_y + 1, ubi3_x + 1) = 0 And matris(ubi4_y + 2, ubi4_x) = 0 Then
  1863.       col6 = False
  1864.      Else
  1865.       col6 = True
  1866.      End If
  1867.    End Select
  1868.   Else
  1869.    Select Case mov
  1870.    Case Is = 1
  1871.     If matris(ubi2_y + 1, ubi2_x) = 0 And matris(ubi4_y + 1, ubi4_x) = 0 Then
  1872.      col6 = False
  1873.     Else
  1874.      col6 = True
  1875.     End If
  1876.    Case Is = 2
  1877.     If matris(ubi1_y, ubi1_x - 1) = 0 And matris(ubi2_y, ubi2_x - 1) = 0 And matris(ubi4_y, ubi4_x - 1) = 0 Then
  1878.      col6 = False
  1879.     Else
  1880.      col6 = True
  1881.     End If
  1882.    Case Is = 3
  1883.     If matris(ubi1_y, ubi1_x + 1) = 0 And matris(ubi3_y, ubi3_x + 1) = 0 And matris(ubi4_y, ubi4_x + 1) = 0 Then
  1884.      col6 = False
  1885.     Else
  1886.      col6 = True
  1887.     End If
  1888.    Case Is = 4 'rotacion
  1889.     If matris(ubi1_y + 1, ubi1_x - 1) = 0 And matris(ubi3_y - 1, ubi3_x - 1) = 0 And matris(ubi4_y - 2, ubi4_x) = 0 Then
  1890.      col6 = False
  1891.     Else
  1892.      col6 = True
  1893.     End If
  1894.    End Select
  1895.   End If
  1896. End Function
  1897.  
  1898. Private Function col7(mov As Integer) As Boolean
  1899.  Dim ubi1_x As Integer
  1900.  Dim ubi1_y As Integer
  1901.  Dim ubi2_x As Integer
  1902.  Dim ubi2_y As Integer
  1903.  Dim ubi3_x As Integer
  1904.  Dim ubi3_y As Integer
  1905.  Dim ubi4_x As Integer
  1906.  Dim ubi4_y As Integer
  1907.  If detenido = True Then Exit Function
  1908.  ubi1_x = (piezas.bloque1.X / 24)
  1909.  ubi1_y = (piezas.bloque1.Y / 24)
  1910.  ubi2_x = (piezas.bloque2.X / 24)
  1911.  ubi2_y = (piezas.bloque2.Y / 24)
  1912.  ubi3_x = (piezas.bloque3.X / 24)
  1913.  ubi3_y = (piezas.bloque3.Y / 24)
  1914.  ubi4_x = (piezas.bloque4.X / 24)
  1915.  ubi4_y = (piezas.bloque4.Y / 24)
  1916.   If piezas.rot = 1 Then
  1917.    Select Case mov
  1918.    Case Is = 1
  1919.     If matris(ubi1_y + 1, ubi1_x) = 0 And matris(ubi3_y + 1, ubi3_x) = 0 And matris(ubi4_y + 1, ubi4_x) = 0 Then
  1920.      col7 = False
  1921.     Else
  1922.      col7 = True
  1923.     End If
  1924.    Case Is = 2
  1925.     If matris(ubi1_y, ubi1_x - 1) = 0 And matris(ubi3_y, ubi3_x - 1) = 0 Then
  1926.      col7 = False
  1927.     Else
  1928.      col7 = True
  1929.     End If
  1930.    Case Is = 3
  1931.     If matris(ubi2_y, ubi2_x + 1) = 0 And matris(ubi4_y, ubi4_x + 1) = 0 Then
  1932.      col7 = False
  1933.     Else
  1934.      col7 = True
  1935.     End If
  1936.    Case Is = 4 'rotacion
  1937.     If ubi1_y > 0 Then
  1938.      If matris(ubi1_y, ubi1_x + 2) = 0 And matris(ubi2_y + 1, ubi2_x + 1) = 0 And matris(ubi4_y + 1, ubi4_x - 1) = 0 Then
  1939.       col7 = False
  1940.      Else
  1941.       col7 = True
  1942.      End If
  1943.     Else
  1944.      col7 = True
  1945.     End If
  1946.    End Select
  1947.   Else
  1948.    Select Case mov
  1949.    Case Is = 1
  1950.     If matris(ubi2_y + 1, ubi2_x) = 0 And matris(ubi4_y + 1, ubi4_x) = 0 Then
  1951.      col7 = False
  1952.     Else
  1953.      col7 = True
  1954.     End If
  1955.    Case Is = 2
  1956.     If matris(ubi1_y, ubi1_x - 1) = 0 And matris(ubi3_y, ubi3_x - 1) = 0 And matris(ubi4_y, ubi4_x - 1) = 0 Then
  1957.      col7 = False
  1958.     Else
  1959.      col7 = True
  1960.     End If
  1961.    Case Is = 3
  1962.     If matris(ubi1_y, ubi1_x + 1) = 0 And matris(ubi2_y, ubi2_x + 1) = 0 And matris(ubi4_y, ubi4_x + 1) = 0 Then
  1963.      col7 = False
  1964.     Else
  1965.      col7 = True
  1966.     End If
  1967.    Case Is = 4 'rotacion
  1968.     If matris(ubi1_y, ubi1_x - 2) = 0 And matris(ubi2_y - 1, ubi2_x - 1) = 0 And matris(ubi4_y - 1, ubi4_x + 1) = 0 Then
  1969.      col7 = False
  1970.     Else
  1971.      col7 = True
  1972.     End If
  1973.    End Select
  1974.   End If
  1975. End Function
  1976.  
  1977. Private Sub check_lines()
  1978.  Dim n As Integer
  1979.  Dim cuantas As Integer
  1980.  Dim numerobloques As Integer
  1981.  Dim numero_de_lineas(19) As Integer
  1982.  Dim f As Integer
  1983.  If detenido = True Then Exit Sub
  1984.  n = 0
  1985.  Do While n <= 19
  1986.   numero_de_lineas(n) = 0
  1987.   n = n + 1
  1988.  Loop
  1989.  n = 0
  1990.  cuantas = 0
  1991.  Do While n <= 19
  1992.   f = 1
  1993.   numerobloques = 0
  1994.   Do While f <= 11
  1995.    If matris(n, f) > 0 Then numerobloques = numerobloques + 1
  1996.    f = f + 1
  1997.   Loop
  1998.   If numerobloques = 11 Then
  1999.    cuantas = cuantas + 1
  2000.    lineas = lineas + 1
  2001.    Label3.Caption = "Lineas: " + Trim(Str(lineas))
  2002.    numero_de_lineas(n) = 1
  2003.   End If
  2004.   n = n + 1
  2005.  Loop
  2006.  If cuantas > 0 Then
  2007.   If cuantas > 1 Then
  2008.    Label11.Caption = "x " + Trim(Str(cuantas))
  2009.    Label11.Top = 236
  2010.    Label11.Left = 116
  2011.    Label11.visible = True
  2012.   End If
  2013.   puntaje = puntaje + ((100 * cuantas) + (50 * (cuantas - 1)))
  2014.   Label4.Caption = "Puntaje: " + Trim(Str(puntaje))
  2015.   blinker_lineas numero_de_lineas()
  2016.   If cuantas > 1 Then
  2017.    Label11.visible = False
  2018.    Label11.Top = 6000
  2019.    Label11.Left = 6000
  2020.   End If
  2021.  End If
  2022. End Sub
  2023.  
  2024. Private Sub blinker_lineas(cuales() As Integer)
  2025.  Dim n As Integer
  2026.  If detenido = True Then Exit Sub
  2027.  n = 0
  2028.  Do While n <= 19
  2029.   If cuales(n) = 1 Then
  2030.    rectangulo_relleno 26, (n * 24) + 2, 24 * 12, ((n * 24) + 24) - 1, &HFFFF&, Picture1
  2031.    suprimir_linea n
  2032.   End If
  2033.   n = n + 1
  2034.  Loop
  2035.  n = Second(Time)
  2036.  Do While n = Second(Time)
  2037.   DoEvents
  2038.  Loop
  2039.  dibujar_matris
  2040. End Sub
  2041.  
  2042. Private Sub suprimir_linea(cual As Integer)
  2043.  Dim n As Integer
  2044.  Dim f As Integer
  2045.  n = cual
  2046.  If detenido = True Then Exit Sub
  2047.  Do While n > 0
  2048.   f = 1
  2049.   Do While f <= 11
  2050.    matris(n, f) = matris(n - 1, f)
  2051.    matris(n - 1, f) = 0
  2052.    f = f + 1
  2053.   Loop
  2054.   n = n - 1
  2055.  Loop
  2056. End Sub
  2057.  
  2058. Private Function llego_arriba() As Boolean
  2059.  Dim n As Integer
  2060.  If detenido = True Then Exit Function
  2061.  llego_arriba = False
  2062.  n = 1
  2063.  Do While n <= 11
  2064.   If matris(0, n) > 0 Then
  2065.    llego_arriba = True
  2066.    Exit Do
  2067.   End If
  2068.   n = n + 1
  2069.  Loop
  2070. End Function
  2071.  
  2072. Private Sub game_over()
  2073.  Dim n As Integer
  2074.  Dim f As Integer
  2075.  n = 0
  2076.  If detenido = True Then Exit Sub
  2077.  Do While n <= 19
  2078.   f = 1
  2079.   Do While f <= 11
  2080.    If matris(n, f) > 0 Then
  2081.     cuadrado_relleno (f * 24) + 2, (n * 24) + 2, 22, &H404040, Picture1
  2082.     cuadrado_vacio f * 24, n * 24, 24, 0, Picture1
  2083.     cuadrado_vacio (f * 24) + 1, (n * 24) + 1, 24, 0, Picture1
  2084.    End If
  2085.    f = f + 1
  2086.   Loop
  2087.   n = n + 1
  2088.  Loop
  2089.  MsgBox ("perdiste")
  2090.  iniciar_juego
  2091. End Sub
  2092.  
  2093. Private Sub ganaste()
  2094.  Dim n As Integer
  2095.  Dim hay As Boolean
  2096.  Dim cual As Integer
  2097.  If detenido = True Then Exit Sub
  2098.  Timer1.Enabled = False
  2099.  n = 0
  2100.  hay = False
  2101.  Do While n <= 9
  2102.   If score(n).score < puntaje Then
  2103.    hay = True
  2104.    cual = n
  2105.    Exit Do
  2106.   End If
  2107.   n = n + 1
  2108.  Loop
  2109.  If hay = True Then
  2110.   Form1.Enabled = False
  2111.   n = 0
  2112.   Do While n <= 9
  2113.    If n <> cual Then
  2114.     Form2.punt(n).Caption = Trim(Str(n + 1)) + ". " + score(n).Nombre + " - " + Trim(Str(score(n).score))
  2115.    Else
  2116.     Form2.punt(n).Caption = Trim(Str(n + 1)) + ".                                                        - " + Trim(Str(puntaje))
  2117.    End If
  2118.    n = n + 1
  2119.   Loop
  2120.   detenido = True
  2121.   Form2.Label2.Caption = Trim(Str(cual))
  2122.   Form2.Label3.Caption = Trim(Str(puntaje))
  2123.   Form2.Text1.Top = 570 + (cual * 300)
  2124.   Form2.Text1.Text = ""
  2125.   Form2.Text1.visible = True
  2126.   Form2.Enabled = True
  2127.   Form2.visible = True
  2128.   Form2.Text1.SetFocus
  2129.  End If
  2130. End Sub
  2131.  
  2132. Private Sub iniciar_juego()
  2133.  Timer1.Enabled = False
  2134.  detenido = True
  2135.  Picture1.Cls
  2136.  Picture2.Cls
  2137.  iniciar_matris
  2138.  puntaje = 0
  2139.  nivel = 1
  2140.  lineas = 0
  2141.  Timer1.Interval = 375
  2142.  contador_piezas = 0
  2143.  Label2.Caption = "Nivel: 1"
  2144.  Label3.Caption = "Lineas: 0"
  2145.  Label4.Caption = "Puntaje: 0"
  2146.  If modo = 4 Then
  2147.   poner_obstaculos
  2148.  End If
  2149.  dibujar_matris
  2150.  preparate
  2151.  iniciar_pieza (Rnd(5) * 6) + 1
  2152.  pieza_siguiente
  2153. End Sub
  2154.  
  2155. Private Sub poner_obstaculos()
  2156.  Dim cant_obstacle As Integer
  2157.  cant_obstacle = 0
  2158.  Do While cant_obstacle <= 2
  2159.   DoEvents
  2160.   cant_obstacle = cant_obstacle + 1
  2161.   matris((Rnd(9) * 10) + 7, (Rnd(9) * 10) + 1) = 1
  2162.  Loop
  2163. End Sub
  2164.  
  2165. Private Sub rise()
  2166.  Dim n As Integer
  2167.  Dim f As Integer
  2168.  If detenido = True Then Exit Sub
  2169.  n = 0
  2170.  Do While n < 19
  2171.   f = 1
  2172.   Do While f <= 11
  2173.    matris(n, f) = matris(n + 1, f)
  2174.    f = f + 1
  2175.   Loop
  2176.   n = n + 1
  2177.  Loop
  2178.  f = 1
  2179.  Do While f <= 11
  2180.   matris(19, f) = matris(18, f)
  2181.   f = f + 1
  2182.  Loop
  2183.  dibujar_matris
  2184. End Sub
  2185.  
  2186. Private Sub strafe()
  2187.  Dim n As Integer
  2188.  Dim f As Integer
  2189.  Dim valor As Integer
  2190.  If detenido = True Then Exit Sub
  2191.  n = 0
  2192.  Do While n <= 19
  2193.   f = 11
  2194.   valor = matris(n, 11)
  2195.   Do While f > 1
  2196.    matris(n, f) = matris(n, f - 1)
  2197.    f = f - 1
  2198.   Loop
  2199.   matris(n, 1) = valor
  2200.   n = n + 1
  2201.  Loop
  2202.  dibujar_matris
  2203. End Sub
  2204.