home *** CD-ROM | disk | FTP | other *** search
/ PC World 2002 December / PCWorld_2002-12_cd.bin / Software / Komercni / Krtek / MOVIE / ROZDILY.DXR / Internal_3_auta.ls < prev    next >
Encoding:
Text File  |  2002-10-07  |  4.6 KB  |  182 lines

  1. property pZdrojeSprite, pZmenySprite, pZdrojeMember, pZmenyMember, pVybraneZmeny, pClick, pSkore, pPocet, pTime, pStuj
  2. global gLevel, gUserInfo, gBodovani, gAuta, gMotylLeti
  3.  
  4. on new me
  5.   iniAuta(me)
  6.   return me
  7. end
  8.  
  9. on iniAuta me
  10.   pZdrojeSprite = 10
  11.   pZmenySprite = 30
  12.   pZdrojeMember = 27
  13.   pZmenyMember = 42
  14.   pStuj = 0
  15.   pClick = [1, 1, 0, 0, 0, 0]
  16.   pSkore = 0
  17.   repeat with i = 10 to 44
  18.     sprite(i).blend = 100
  19.     sprite(i).visible = 1
  20.   end repeat
  21.   getZmeny(me)
  22.   setZmeny(me)
  23.   add(the actorList, me)
  24.   if windowPresent("stavHry") then
  25.     tell window("stavHry")
  26.       gBodovani.ini()
  27.     end tell
  28.   end if
  29. end
  30.  
  31. on startTime
  32.   pTime = the ticks
  33.   if windowPresent("stavHry") then
  34.     tell window("stavHry")
  35.       gBodovani.iniTime(1)
  36.     end tell
  37.   end if
  38. end
  39.  
  40. on getZmeny me
  41.   pVybraneZmeny = [:]
  42.   repeat with i = 1 to 15
  43.     addProp(pVybraneZmeny, symbol(string(i)), 0)
  44.   end repeat
  45.   pomlist = []
  46.   if voidp(gLevel) then
  47.     gLevel = 1
  48.   end if
  49.   if gLevel = 1 then
  50.     repeat while pomlist.count < 5
  51.       xx = random(15)
  52.       if (xx <> 11) and (xx <> 5) and (xx <> 12) then
  53.         if getPos(pomlist, xx) = 0 then
  54.           add(pomlist, xx)
  55.         end if
  56.       end if
  57.     end repeat
  58.     pPocet = 5
  59.   else
  60.     repeat while pomlist.count < 10
  61.       xx = random(15)
  62.       if getPos(pomlist, xx) = 0 then
  63.         add(pomlist, xx)
  64.       end if
  65.     end repeat
  66.     pPocet = 10
  67.   end if
  68.   repeat with i = 1 to pomlist.count
  69.     pX = symbol(string(pomlist[i]))
  70.     setProp(pVybraneZmeny, pX, 1)
  71.   end repeat
  72. end
  73.  
  74. on setZmeny me
  75.   repeat with i = 1 to 15
  76.     if pVybraneZmeny[i] = 1 then
  77.       pM = "Layer " & string(pZmenyMember - 1 + i)
  78.     else
  79.       pM = "Layer " & string(pZdrojeMember - 1 + i)
  80.       pMorig = "Layer " & string(pZmenyMember - 1 + i)
  81.       sprite(pZmenySprite - 1 + i).locV = sprite(pZmenySprite - 1 + i).locV + (member(pM).regPoint[2] - member(pMorig).regPoint[2])
  82.     end if
  83.     sprite(pZmenySprite - 1 + i).member = member(pM)
  84.     updateStage()
  85.   end repeat
  86. end
  87.  
  88. on clickKarta me, pSpriteNum, xclickPocet
  89.   if soundBusy(1) or (sprite(pSpriteNum).blend = 30) then
  90.     exit
  91.   end if
  92.   if (pSpriteNum >= pZdrojeSprite) and (pSpriteNum <= (pZdrojeSprite + 15)) and (pClick[1] = 1) then
  93.     sprite(pSpriteNum + 40).visible = 1
  94.     pClick[1] = 2
  95.     pClick[3] = sprite(pSpriteNum).member.name
  96.     pClick[5] = pSpriteNum
  97.   end if
  98.   if (pSpriteNum >= pZmenySprite) and (pSpriteNum <= (pZmenySprite + 15)) and (pClick[2] = 1) then
  99.     pClick[2] = 2
  100.     pClick[4] = sprite(pSpriteNum).member.name
  101.     sprite(pSpriteNum + 40).visible = 1
  102.     pClick[6] = pSpriteNum
  103.   end if
  104.   if (pClick[1] = 2) and (pClick[2] = 2) then
  105.     me.vyhodnot()
  106.   end if
  107. end
  108.  
  109. on vyhodnot me
  110.   updateStage()
  111.   pStuj = 1
  112.   if (pClick[3] = pClick[4]) or (abs(integer(pClick[3].char[7..8] - pClick[4].char[7..8])) <> 15) then
  113.     zvukNe()
  114.     if windowPresent("stavHry") then
  115.       tell window("stavHry")
  116.         er = gBodovani.getBodyError() + 1
  117.         gBodovani.setBodyError(er)
  118.       end tell
  119.     end if
  120.   else
  121.     if windowPresent("stavHry") then
  122.       tell window("stavHry")
  123.         er = gBodovani.getBodyOK() + 1
  124.         gBodovani.setBodyOk(er)
  125.       end tell
  126.     end if
  127.     if (sprite(pClick[6]).pClick1 = 1) and (sprite(pClick[5]).pClick1 = 1) then
  128.       pSkore = pSkore + 2
  129.     end if
  130.     if (sprite(pClick[6]).pClick1 > 2) or (sprite(pClick[5]).pClick1 > 2) then
  131.       pSkore = pSkore
  132.     else
  133.       if (sprite(pClick[6]).pClick1 = 2) or (sprite(pClick[5]).pClick1 = 2) then
  134.         pSkore = pSkore + 1
  135.       end if
  136.     end if
  137.     pPocet = pPocet - 1
  138.     sprite(pClick[5]).blend = 30
  139.     sprite(pClick[6]).blend = 30
  140.     sprite(pClick[5]).cursor = 291
  141.     sprite(pClick[6]).cursor = 291
  142.     zvukAno()
  143.     if pPocet = 0 then
  144.       me.KONECHRY()
  145.     end if
  146.   end if
  147.   if windowPresent("stavHry") then
  148.     tell window("stavHry")
  149.       pom = gBodovani.getBodyOK() * 100 / (gBodovani.getBodyError() + gBodovani.getBodyOK())
  150.       gBodovani.setteplomer(pom)
  151.       gBodovani.setSkore(pSkore)
  152.     end tell
  153.   end if
  154. end
  155.  
  156. on KONECHRY me
  157.   xx = setScoreFinal()
  158.   if xx >= gUserInfo.Hry.rozdily.skore then
  159.     gUserInfo.Hry.rozdily.cas = (the ticks - pTime) / 60
  160.     gUserInfo.Hry.rozdily.WRONG = gBodovani.getBodyError()
  161.     gUserInfo.Hry.rozdily.Ok = gBodovani.getBodyOK()
  162.     gUserInfo.Hry.rozdily.skore = xx
  163.     updateDB(gUserInfo.jmeno)
  164.   end if
  165.   if getOne(the actorList, gAuta) then
  166.     deleteOne(the actorList, gAuta)
  167.   end if
  168.   if getOne(the actorList, gMotylLeti) then
  169.     deleteOne(the actorList, gMotylLeti)
  170.   end if
  171.   go(the frame + 1)
  172. end
  173.  
  174. on stepFrame me
  175.   if not soundBusy(1) and (pStuj = 1) then
  176.     sprite(pClick[5] + 40).visible = 0
  177.     sprite(pClick[6] + 40).visible = 0
  178.     pStuj = 0
  179.     pClick = [1, 1, 0, 0, 0, 0]
  180.   end if
  181. end
  182.