home *** CD-ROM | disk | FTP | other *** search
/ Mundo do CD-ROM 15 / MUNDO15.iso / entrete / Osmar / QUEBRA.DXR / 00005.ls < prev    next >
Encoding:
Text File  |  1997-10-13  |  1.1 KB  |  52 lines

  1. on InitFaseVars
  2.   global glbWQC
  3.   set glbWQC to "ini"
  4. end
  5.  
  6. on PrepareGame wp
  7.   global initabuleiro, numpecas
  8.   set t to []
  9.   set pospecas to []
  10.   set col to 6
  11.   set lin to 6
  12.   set initabuleiro to 1
  13.   set numpecas to col * lin
  14.   repeat with i = 1 to numpecas
  15.     setAt(t, i, i)
  16.   end repeat
  17.   repeat with j = 1 to numpecas
  18.     set r to random(numpecas)
  19.     repeat while getAt(t, r) = 0
  20.       set r to random(numpecas)
  21.     end repeat
  22.     setAt(t, r, 0)
  23.     setAt(pospecas, j, r)
  24.   end repeat
  25.   repeat with j = 1 to numpecas
  26.     set p to initabuleiro + j
  27.     puppetSprite(p, 1)
  28.     set nam to string(getAt(pospecas, j))
  29.     if length(nam) < 2 then
  30.       set nam to "0" & nam
  31.     end if
  32.     set nam to wp & nam
  33.     set the castNum of sprite p to cast nam
  34.   end repeat
  35. end
  36.  
  37. on verifyfinish
  38.   global initabuleiro, numpecas
  39.   set term to 1
  40.   repeat with i = 1 to numpecas
  41.     set n to the name of cast the castNum of sprite (initabuleiro + i)
  42.     if value(chars(n, 2, 5)) <> i then
  43.       set term to 0
  44.       exit repeat
  45.     end if
  46.   end repeat
  47.   if term then
  48.     alert("ganhou")
  49.     go(the frame + 1)
  50.   end if
  51. end
  52.