home *** CD-ROM | disk | FTP | other *** search
- property pZdrojeSprite, pZmenySprite, pZdrojeMember, pZmenyMember, pVybraneZmeny, pClick, pSkore, pPocet, pTime, pStuj
- global gLevel, gUserInfo, gBodovani, gAuta, gMotylLeti
-
- on new me
- iniAuta(me)
- return me
- end
-
- on iniAuta me
- pZdrojeSprite = 10
- pZmenySprite = 30
- pZdrojeMember = 27
- pZmenyMember = 42
- pStuj = 0
- pClick = [1, 1, 0, 0, 0, 0]
- pSkore = 0
- repeat with i = 10 to 44
- sprite(i).blend = 100
- sprite(i).visible = 1
- end repeat
- getZmeny(me)
- setZmeny(me)
- add(the actorList, me)
- if windowPresent("stavHry") then
- tell window("stavHry")
- gBodovani.ini()
- end tell
- end if
- end
-
- on startTime
- pTime = the ticks
- if windowPresent("stavHry") then
- tell window("stavHry")
- gBodovani.iniTime(1)
- end tell
- end if
- end
-
- on getZmeny me
- pVybraneZmeny = [:]
- repeat with i = 1 to 15
- addProp(pVybraneZmeny, symbol(string(i)), 0)
- end repeat
- pomlist = []
- if voidp(gLevel) then
- gLevel = 1
- end if
- if gLevel = 1 then
- repeat while pomlist.count < 5
- xx = random(15)
- if (xx <> 11) and (xx <> 5) and (xx <> 12) then
- if getPos(pomlist, xx) = 0 then
- add(pomlist, xx)
- end if
- end if
- end repeat
- pPocet = 5
- else
- repeat while pomlist.count < 10
- xx = random(15)
- if getPos(pomlist, xx) = 0 then
- add(pomlist, xx)
- end if
- end repeat
- pPocet = 10
- end if
- repeat with i = 1 to pomlist.count
- pX = symbol(string(pomlist[i]))
- setProp(pVybraneZmeny, pX, 1)
- end repeat
- end
-
- on setZmeny me
- repeat with i = 1 to 15
- if pVybraneZmeny[i] = 1 then
- pM = "Layer " & string(pZmenyMember - 1 + i)
- else
- pM = "Layer " & string(pZdrojeMember - 1 + i)
- pMorig = "Layer " & string(pZmenyMember - 1 + i)
- sprite(pZmenySprite - 1 + i).locV = sprite(pZmenySprite - 1 + i).locV + (member(pM).regPoint[2] - member(pMorig).regPoint[2])
- end if
- sprite(pZmenySprite - 1 + i).member = member(pM)
- updateStage()
- end repeat
- end
-
- on clickKarta me, pSpriteNum, xclickPocet
- if soundBusy(1) or (sprite(pSpriteNum).blend = 30) then
- exit
- end if
- if (pSpriteNum >= pZdrojeSprite) and (pSpriteNum <= (pZdrojeSprite + 15)) and (pClick[1] = 1) then
- sprite(pSpriteNum + 40).visible = 1
- pClick[1] = 2
- pClick[3] = sprite(pSpriteNum).member.name
- pClick[5] = pSpriteNum
- end if
- if (pSpriteNum >= pZmenySprite) and (pSpriteNum <= (pZmenySprite + 15)) and (pClick[2] = 1) then
- pClick[2] = 2
- pClick[4] = sprite(pSpriteNum).member.name
- sprite(pSpriteNum + 40).visible = 1
- pClick[6] = pSpriteNum
- end if
- if (pClick[1] = 2) and (pClick[2] = 2) then
- me.vyhodnot()
- end if
- end
-
- on vyhodnot me
- updateStage()
- pStuj = 1
- if (pClick[3] = pClick[4]) or (abs(integer(pClick[3].char[7..8] - pClick[4].char[7..8])) <> 15) then
- zvukNe()
- if windowPresent("stavHry") then
- tell window("stavHry")
- er = gBodovani.getBodyError() + 1
- gBodovani.setBodyError(er)
- end tell
- end if
- else
- if windowPresent("stavHry") then
- tell window("stavHry")
- er = gBodovani.getBodyOK() + 1
- gBodovani.setBodyOk(er)
- end tell
- end if
- if (sprite(pClick[6]).pClick1 = 1) and (sprite(pClick[5]).pClick1 = 1) then
- pSkore = pSkore + 2
- end if
- if (sprite(pClick[6]).pClick1 > 2) or (sprite(pClick[5]).pClick1 > 2) then
- pSkore = pSkore
- else
- if (sprite(pClick[6]).pClick1 = 2) or (sprite(pClick[5]).pClick1 = 2) then
- pSkore = pSkore + 1
- end if
- end if
- pPocet = pPocet - 1
- sprite(pClick[5]).blend = 30
- sprite(pClick[6]).blend = 30
- sprite(pClick[5]).cursor = 291
- sprite(pClick[6]).cursor = 291
- zvukAno()
- if pPocet = 0 then
- me.KONECHRY()
- end if
- end if
- if windowPresent("stavHry") then
- tell window("stavHry")
- pom = gBodovani.getBodyOK() * 100 / (gBodovani.getBodyError() + gBodovani.getBodyOK())
- gBodovani.setteplomer(pom)
- gBodovani.setSkore(pSkore)
- end tell
- end if
- end
-
- on KONECHRY me
- xx = setScoreFinal()
- if xx >= gUserInfo.Hry.rozdily.skore then
- gUserInfo.Hry.rozdily.cas = (the ticks - pTime) / 60
- gUserInfo.Hry.rozdily.WRONG = gBodovani.getBodyError()
- gUserInfo.Hry.rozdily.Ok = gBodovani.getBodyOK()
- gUserInfo.Hry.rozdily.skore = xx
- updateDB(gUserInfo.jmeno)
- end if
- if getOne(the actorList, gAuta) then
- deleteOne(the actorList, gAuta)
- end if
- if getOne(the actorList, gMotylLeti) then
- deleteOne(the actorList, gMotylLeti)
- end if
- go(the frame + 1)
- end
-
- on stepFrame me
- if not soundBusy(1) and (pStuj = 1) then
- sprite(pClick[5] + 40).visible = 0
- sprite(pClick[6] + 40).visible = 0
- pStuj = 0
- pClick = [1, 1, 0, 0, 0, 0]
- end if
- end
-