home *** CD-ROM | disk | FTP | other *** search
- function clickPita()
- {
- if(_root.pitaTaken == 0)
- {
- _root.pitaTaken = 1;
- tellTarget("_root.R_Hand")
- {
- gotoAndStop("getting pita");
- play();
- }
- }
- }
- function rolloverElement(whichClip)
- {
- tellTarget("duchan.all_salads.all_" add whichClip._name)
- {
- if(_root.pitaTaken == 1)
- {
- gotoAndPlay("contor " add currentState);
- }
- }
- }
- function rolloutElement(whichClip)
- {
- tellTarget("duchan.all_salads.all_" add whichClip._name)
- {
- gotoAndPlay(currentState);
- }
- }
- function click_element(whichClip)
- {
- if(_root.pitaTaken == 1)
- {
- if(eval("duchan.all_salads.all_" add whichClip._name add ".currentState") != "empty")
- {
- _root.manageElements(eval("duchan.all_salads.all_" add whichClip._name));
- tellTarget("_root.L_Hand")
- {
- gotoAndPlay("getting " add whichClip._name);
- theElement = whichClip;
- }
- }
- }
- }
- function add_element(whichClip)
- {
- whichClip.counter += 1;
- if(whichClip.maxElements >= whichClip.counter)
- {
- whichClip.counterText = whichClip.maxElements - whichClip.counter;
- }
- else
- {
- whichClip.counterText = 0;
- }
- if(whichClip.maxElements < whichClip.counter)
- {
- _root.score -= 5;
- showPoints("-5");
- updateCharInterval();
- _root.buzzSound.start();
- }
- else
- {
- _root.score += 1;
- showPoints("+1");
- updateCharInterval();
- }
- if(whichClip.counter == whichClip.maxElements)
- {
- theElement = "_root.R_Hand.pita." add whichClip._name add "_element";
- eval(theElement)._visible = 1;
- _root.R_Hand.pita.countElements += 1;
- if(R_Hand.pita.countElements == 4)
- {
- _root.pitaIsFull = true;
- _root.manaSound.start();
- }
- }
- }
- function click_person(whichClip)
- {
- if(_root.pitaIsFull == true and _root.achmedIsOut == false)
- {
- _root.givePita(whichClip);
- }
- else
- {
- var checkStatus = 0;
- i = 0;
- while(i < _root.elementList.length)
- {
- theClip = "_root.duchan." add _root.elementList[i];
- if(eval(theClip).counterText == 0)
- {
- checkStatus += 1;
- }
- i++;
- }
- if(checkStatus >= 4 and _root.achmedIsOut == false)
- {
- _root.givePita(whichClip);
- }
- }
- }
- function givePita(whichClip)
- {
- tellTarget(_root.R_Hand)
- {
- gotoAndStop("giving pita");
- play();
- tellTarget(_root.R_Hand.pitaToGive)
- {
- gotoAndPlay("p" add whichClip.posX.charAt(whichClip.posX.length - 1));
- }
- }
- _root.score += 5;
- showPoints("+5");
- tellTarget(whichClip)
- {
- gotoAndStop("with pita");
- play();
- }
- _root.resetPita();
- }
- function resetPita()
- {
- _root.pitaTaken = 0;
- _root.pitaIsFull = false;
- _root.pita.countElements = 0;
- i = 0;
- while(i < _root.elementList.length)
- {
- theClip = "_root.duchan." add _root.elementList[i];
- theElement = "_root.pita." add _root.elementList[i] add "_element";
- eval(theClip).maxElements = Number(findRandom(3));
- eval(theClip).counter = 0;
- eval(theClip).counterText = eval(theClip).maxElements;
- eval(theElement)._visible = 0;
- i++;
- }
- }
- function updateCharInterval()
- {
- if(_root.score < 20)
- {
- _root.charInterval = 10000;
- }
- else if(_root.score < 40)
- {
- _root.charInterval = 8000;
- }
- else if(_root.score < 60)
- {
- _root.charInterval = 5000;
- }
- else if(_root.score < 80)
- {
- _root.charInterval = 2000;
- }
- else if(_root.score >= 120)
- {
- _root.charInterval = 1000;
- }
- }
- function manageFalafel()
- {
- if(_root.L_Hand.falafel_fly1.falafelInAir == true)
- {
- if(_root.L_Hand.falafel_fly2.falafelInAir == true)
- {
- if(_root.L_Hand.falafel_fly3.falafelInAir != true)
- {
- tellTarget("_root.L_Hand.falafel_fly3")
- {
- _visible = 1;
- play();
- }
- }
- }
- else
- {
- tellTarget("_root.L_Hand.falafel_fly2")
- {
- _visible = 1;
- play();
- }
- }
- }
- else
- {
- tellTarget("_root.L_Hand.falafel_fly1")
- {
- _visible = 1;
- play();
- }
- }
- }
- function manageElements(whichElement)
- {
- if(0 < whichElement.quantity)
- {
- whichElement.quantity -= 1;
- }
- if(0.75 < whichElement.quantity / _root.fullQuantity)
- {
- whichElement.currentState = "full";
- whichElement.currentStateNum = 4;
- whichElement.currentPercent = "100%";
- }
- else if(0.5 < whichElement.quantity / _root.fullQuantity)
- {
- whichElement.currentState = "TQ";
- whichElement.currentStateNum = 3;
- whichElement.currentPercent = "75%";
- }
- else if(0.25 < whichElement.quantity / _root.fullQuantity)
- {
- whichElement.currentState = "Half";
- whichElement.currentStateNum = 2;
- whichElement.currentPercent = "50%";
- }
- else if(0 < whichElement.quantity / _root.fullQuantity)
- {
- whichElement.currentState = "QT";
- whichElement.currentStateNum = 1;
- whichElement.currentPercent = "25%";
- }
- else
- {
- whichElement.currentState = "empty";
- whichElement.currentStateNum = 0;
- whichElement.currentPercent = "0%";
- }
- tellTarget(whichElement)
- {
- gotoAndPlay(String(currentState));
- percent_indicator.gotoAndPlay("n-" add currentState);
- }
- }
- function fillUp(elementName)
- {
- currentStateNum = eval("duchan.all_salads.all_" add elementName add ".currentStateNum");
- if(currentStateNum < 4)
- {
- currentStateNum += 1;
- quantity = currentStateNum * Math.round(_root.fullQuantity / 4);
- if(currentStateNum == 4)
- {
- currentState = "full";
- }
- else if(currentStateNum == 3)
- {
- currentState = "TQ";
- }
- else if(currentStateNum == 2)
- {
- currentState = "Half";
- }
- else if(currentStateNum == 1)
- {
- currentState = "QT";
- }
- else
- {
- currentState = "Empty";
- }
- set("duchan.all_salads.all_" add elementName add ".quantity",quantity);
- set("duchan.all_salads.all_" add elementName add ".currentState",currentState);
- set("duchan.all_salads.all_" add elementName add ".currentStateNum",currentStateNum);
- tellTarget("duchan.all_salads.all_" add elementName)
- {
- gotoAndPlay(String(currentState));
- percent_indicator.gotoAndPlay("n-" add currentState);
- }
- }
- }
-