Frame 1
function f_varInit() {
trace("f_varInit");
_global.p_fncs.fnc_trackGame();
root.i_level = 1;
root.i_rot = 0;
root.b_stopTime = false;
root.b_catching = true;
root.b_power = false;
root.i_totalNrg = 0;
root.i_yourNrg = 0;
root.i_overNrg = 0;
root.b_levelDone = false;
root.b_gameOver = false;
_root.b_rotWind = true;
_level0.a_lights = new Array();
root.b_question = false;
}
function f_start() {
f_varInit();
f_gfxInit();
f_listenerInit();
f_levelInit();
root.o_info.time_tf.textfield_tf.info_tf.text = "ZEIT: " + i_timeSet;
}
function f_listenerInit() {
trace("f_listenerInit");
root.mouseListener = new Object();
root.mouseListener.onMouseDown = function () {
if ((!b_catching) && (!root.abbruch_mc)) {
f_bucketCatchOut();
}
};
Mouse.addListener(root.mouseListener);
root.keyListener = new Object();
root.keyListener.onKeyDown = function () {
if (Key.isDown(81) or Key.isDown(27)) {
if (!root.abbruch_mc) {
f_cancelGame();
}
}
};
Key.addListener(root.keyListener);
}
function f_loadQuestions() {
var _local1 = _root;
trace("f_loadQuestions");
_local1.b_questionsLoaded = false;
_local1.xml_questions = new XML();
_local1.xml_questions.load("questions.xml");
_local1.xml_questions.ignoreWhite = true;
_local1.xml_questions.onLoad = function () {
_root.b_questionsLoaded = true;
};
}
function f_gfxInit() {
root.attachMovie("game_mask", "game_mask", 10000);
root.createEmptyMovieClip("game_ct", 10);
root.game_ct.setMask(root.game_mask);
root.game_ct.attachMovie("bagger_mc", "bagger_mc", 40);
root.o_bagger = root.game_ct.bagger_mc;
root.o_bagger.stop();
root.o_bagger._x = 190;
root.o_bagger._y = 7;
root.game_ct.attachMovie("info_mc", "info_mc", 100);
root.o_info = root.game_ct.info_mc;
root.o_info._x = 30;
root.o_info._y = 330;
root.game_ct.createEmptyMovieClip("level_mc", 50);
root.o_level = root.game_ct.level_mc;
root.game_ct.attachMovie("erde_mc", "erde_mc", 5);
root.game_ct.erde_mc._y = 39;
root.game_ct.attachMovie("skyline_mc", "skyline_mc", 1);
root.game_ct.skyline_mc._y = -216;
root.game_ct.attachMovie("lights_mc", "lights_mc", 2);
root.o_lights = root.game_ct.lights_mc;
root.o_lights._alpha = 0;
root.o_lights._x = 20;
root.o_lights._y = -46;
root.game_ct.attachMovie("nacht_mc", "nacht_mc", 200);
root.o_night = root.game_ct.nacht_mc;
root.o_night._y = -216;
root.o_night._alpha = 0;
}
function f_bucketSwing() {
trace("f_bucketSwing: i_rot = " + i_rot);
root.o_bagger.createEmptyMovieClip("emc_swing", 10);
root.o_bagger.emc_swing.onEnterFrame = function () {
i_rot = i_rot + i_rotationSpeed;
if (i_rot > 360) {
i_rot = 0;
}
root.o_bagger.schaufel_ct._rotation = Math.sin((Math.PI/180) * i_rot) * 60;
};
}
function f_stopBucketSwing() {
trace("f_stopBucketSwing");
root.o_bagger.emc_swing.removeMovieClip();
}
function f_bucketCatchOut() {
var _local2 = this;
trace("f_bucketCatchOut");
f_stopSound("fx_back");
f_playSound("fx_catching", 9999);
b_catching = true;
if (b_power) {
f_usePower();
}
f_stopBucketSwing();
root.o_bagger.fahrer_ani.play();
var i_seilLength = 10;
root.o_bagger.createEmptyMovieClip("emc_catch", 10);
root.o_bagger.emc_catch.onEnterFrame = function () {
var _local2 = this;
root.o_bagger.schaufel_ct.schaufel_mc._y = root.o_bagger.schaufel_ct.schaufel_mc._y + i_catchingSpeed;
i_seilLength = i_seilLength + i_catchingSpeed;
root.o_bagger.schaufel_ct.seil_mc._height = i_seilLength;
var _local1 = 0;
while (_local1 < root.a_level.length) {
if (root.o_bagger.schaufel_ct.schaufel_mc.hitThis_mc.hitTest(root.a_level[_local1].hitThis_mc)) {
f_bucketBack(_local1);
_local2.removeMovieClip();
break;
}
_local1++;
}
if ((root.o_bagger.schaufel_ct.schaufel_mc._y >= 350) or b_levelDone) {
f_bucketBack();
_local2.removeMovieClip();
}
};
}
function f_bucketBack(i_item) {
trace("f_bucketBack: " + i_item);
if ((f_getItemTyp(i_item) == "sk") or (f_getItemTyp(i_item) == "bk")) {
f_playSound("fx_kohle");
}
if ((f_getItemTyp(i_item) == "fr") or (f_getItemTyp(i_item) == "kr")) {
f_playSound("fx_extra");
}
if (f_getItemTyp(i_item) == "mw") {
f_playSound("fx_mauli");
}
f_stopSound("fx_catching");
f_playSound("fx_back", 999);
var b_itemFlag = false;
var i_spd = i_catchingSpeed;
root.o_bagger.fahrer_ani.play();
root.o_level.attachMovie("schaufel_halb_gfx", "schaufel_halb_gfx", 101);
root.o_level.schaufel_halb_gfx._visible = false;
root.o_level.schaufel_halb_gfx._rotation = root.o_bagger.schaufel_ct._rotation;
if (f_getItemTyp(i_item) == "mw") {
root.a_level[i_item].b_catched = true;
root.a_level[i_item].mw1_ani._visible = false;
root.a_level[i_item].mw2_ani._visible = true;
}
var i_seilLength = root.o_bagger.schaufel_ct.seil_mc._height;
root.o_bagger.createEmptyMovieClip("emc_back", 10);
root.o_bagger.emc_back.onEnterFrame = function () {
root.o_bagger.schaufel_ct.schaufel_mc._y = root.o_bagger.schaufel_ct.schaufel_mc._y - i_spd;
i_seilLength = i_seilLength - i_spd;
root.o_bagger.schaufel_ct.seil_mc._height = i_seilLength;
if (i_item != undefined) {
f_takeItem(i_item);
if ((!b_itemFlag) && (!b_levelDone)) {
if (!b_power) {
var _local1 = 0.7;
} else {
var _local1 = 0.1;
}
i_spd = i_spd / ((f_getItemWeight(i_item) * _local1) + 1);
root.o_bagger.play();
root.o_bagger.schaufel_ct.schaufel_mc.gotoAndStop(2);
b_itemFlag = true;
}
if (b_levelDone) {
i_spd = i_catchingSpeed;
}
}
if (root.o_bagger.schaufel_ct.schaufel_mc._y <= 0) {
root.o_bagger.schaufel_ct.schaufel_mc._y = 10;
root.o_bagger.schaufel_ct.seil_mc._height = 10;
f_stopSound("fx_back");
if (b_levelDone) {
root.o_bagger.schaufel_ct._rotation = 1.22460635382238E-16;
} else if (i_item != undefined) {
f_itemAction(i_item);
} else {
f_bucketSwing();
b_catching = false;
}
root.o_bagger.fahrer_ani.play();
root.o_bagger.stop();
if (i_power <= 0) {
f_removePower();
}
root.o_level.schaufel_halb_gfx.removeMovieClip();
this.removeMovieClip();
}
};
}
function f_takeItem(i_item) {
var _local2 = this;
var _local1 = root.a_level[i_item];
if (!b_levelDone) {
root.o_bagger.schaufel_ct.schaufel_mc.localToGlobal((ltgBucket = {x:_local2._x, y:_local2._y + i_bucketCatchOffset}));
_local1._y = ltgBucket.y;
_local1._x = ltgBucket.x;
if (!root.o_level.schaufel_halb_gfx._visible) {
root.o_level.schaufel_halb_gfx._visible = true;
}
root.o_level.schaufel_halb_gfx._x = ltgBucket.x;
root.o_level.schaufel_halb_gfx._y = ltgBucket.y;
} else {
root.o_level.schaufel_halb_gfx.removeMovieClip();
_local1.createEmptyMovieClip("emc_item", 10);
_local1.emc_item.onEnterFrame = function () {
var _local1 = this;
_local1._parent._y = _local1._parent._y + 5;
if (_local1._parent._y > 200) {
_local1.removeMovieClip();
}
};
}
}
function f_itemAction(i_item) {
trace("f_itemAction: " + i_item);
var s_typ = f_getItemTyp(i_item);
var o_item = root.a_level[i_item];
var b_itemRemoved = false;
if ((s_typ == "sk") or (s_typ == "bk")) {
trace(" aktion: sk oder bk");
f_bucketSwing();
root.bagger_mc.fahrer_ani.play();
f_setNrg(f_getItemValue(i_item));
}
if (s_typ == "mw") {
trace(" aktion: maulwurf");
f_mwFallingDown(i_item);
f_bucketSwing();
root.bagger_mc.fahrer_ani.play();
f_setNrg(f_getItemValue(i_item));
}
if (s_typ == "fr") {
trace(" aktion: frage");
f_preQuestion(i_item);
}
if (s_typ == "kr") {
trace(" aktion: kraft");
f_getPower();
f_bucketSwing();
root.bagger_mc.fahrer_ani.play();
f_setNrg(f_getItemValue(i_item));
}
root.o_bagger.schaufel_ct.schaufel_mc.gotoAndStop(1);
o_item.hitThis_mc._x = 10000;
if ((!b_levelDone) && (s_typ != "fr")) {
b_catching = false;
}
o_item.createEmptyMovieClip("emc_item", 10);
o_item.emc_item.onEnterFrame = function () {
if (s_typ == "mw") {
root.a_level.splice(i_item, 1);
if (root.a_level.length == 0) {
f_levelDone();
}
this.removeMovieClip();
} else {
if ((s_typ != "fr") && (!b_itemRemoved)) {
root.a_level.splice(i_item, 1);
b_itemRemoved = true;
}
if (o_item._alpha > 0) {
o_item._alpha = o_item._alpha - 4;
} else {
if ((s_typ != "fr") && (root.a_level.length == 0)) {
f_levelDone();
}
o_item._visible = false;
this.removeMovieClip();
}
}
};
}
function f_mwWalk(i_item) {
trace("f_mwWalk");
var o_mw = root.a_level[i_item];
var i_walk = 1;
var i_x0 = o_mw._x;
var i_dx = (50 + random(100));
o_mw.mw2_ani._visible = false;
o_mw.onEnterFrame = function () {
if (!o_mw.b_catched) {
if (o_mw._x < ((-i_dx) + i_x0)) {
i_walk = -i_walk;
o_mw.gotoAndStop(2);
} else if (o_mw._x > (i_dx + i_x0)) {
i_walk = -i_walk;
o_mw.gotoAndStop(3);
}
o_mw._x = o_mw._x + i_walk;
}
};
}
function f_startMwWalkAgain() {
trace("f_startMwWalk");
var _local1 = 0;
while (_local1 < root.a_level.length) {
if (f_getItemTyp(_local1) == "mw") {
root.a_level[_local1].b_catched = false;
root.a_level[_local1].mw1_ani.play();
}
_local1++;
}
}
function f_stopMwWalk() {
trace("f_stopMwWalk");
var _local1 = 0;
while (_local1 < root.a_level.length) {
if (f_getItemTyp(_local1) == "mw") {
root.a_level[_local1].b_catched = true;
root.a_level[_local1].mw1_ani.stop();
}
_local1++;
}
}
function f_mwFallingDown(i_item) {
trace("f_mwFallingDown");
f_playSound("fx_falling");
var _local1 = root.a_level[i_item];
_local1.mw2_ani.play();
}
function f_stopQuestSign() {
trace("f_stopQuestSign");
var _local1 = 0;
while (_local1 < root.a_level.length) {
if ((f_getItemTyp(_local1) == "fr") or (f_getItemTyp(_local1) == "kr")) {
root.a_level[_local1].truhe_mc.fz_ani.stop();
}
_local1++;
}
}
function f_playQuestSign() {
trace("f_stopQuestSign");
var _local1 = 0;
while (_local1 < root.a_level.length) {
if ((f_getItemTyp(_local1) == "fr") or (f_getItemTyp(_local1) == "kr")) {
root.a_level[_local1].truhe_mc.fz_ani.play();
}
_local1++;
}
}
function f_getPower() {
trace("f_getPower");
if (!b_power) {
f_playSound("fx_power", 999);
}
if (b_power) {
i_power = i_power + 4;
} else {
i_power = 4;
}
b_power = true;
root.o_info.attachMovie("power_mc", "power_mc", 98);
f_usePower();
}
function f_usePower() {
trace("f_usePower");
i_power--;
root.o_info.power_mc.power_tf.bt_tf_in.name_tf.text = i_power + "x ";
}
function f_removePower() {
trace("f_removePower");
f_stopSound("fx_power");
b_power = false;
root.o_info.power_mc.removeMovieClip();
}
function f_preQuestion(i_item) {
var _local1 = i_item;
var _local2 = _root;
trace("f_preQuestion: " + _local1);
trace(" itemValue: " + f_getItemValue(_local1));
f_playSound("fx_popUp");
_local2.b_rotWind = false;
f_stopMwWalk();
f_stopQuestSign();
b_stopTime = true;
b_question = true;
root.attachMovie("vorfrage_mc", "vorfrage_mc", 1000);
root.vorfrage_mc._x = 30;
root.vorfrage_mc._y = 100;
root.vorfrage_mc.titel_mc.bt_tf_in.name_tf.text = "ZEIT WURDE ANGEHALTEN";
root.vorfrage_mc.frage_tf.autoSize = true;
root.vorfrage_mc.frage_tf.text = ("M\u00F6chten sie eine Frage beantworten. F\u00FCr die richtige Antwort erhalten sie " + f_getItemValue(_local1)) + " an Energie.";
root.vorfrage_mc.bt_nein.bt_tf.bt_tf_in.name_tf.text = "NEIN";
root.vorfrage_mc.bt_nein.i_item = _local1;
_local2.menu.f_rollOverOut(root.vorfrage_mc.bt_nein);
root.vorfrage_mc.bt_nein.onRelease = function () {
f_questionDone(this.i_item);
root.vorfrage_mc.removeMovieClip();
};
root.vorfrage_mc.bt_ja.bt_tf.bt_tf_in.name_tf.text = "JA";
root.vorfrage_mc.bt_ja.i_item = _local1;
_local2.menu.f_rollOverOut(root.vorfrage_mc.bt_ja);
root.vorfrage_mc.bt_ja.onRelease = function () {
f_question(this.i_item);
root.vorfrage_mc.removeMovieClip();
};
}
function f_question(i_item) {
trace("f_question: " + i_item);
trace(" itemValue: " + f_getItemValue(i_item));
root.attachMovie("frage_mc", "frage_mc", 1000);
root.frage_mc._x = 30;
root.frage_mc._y = 100;
var xml_rootNode = _root.xml_questions.firstChild;
var i_xmlID;
var _local3 = false;
if (a_questionID.length == xml_rootNode.childNodes.length) {
root.a_questionID = new Array();
}
if (a_questionID.length > 0) {
var _local1 = 0;
while (_local1 < xml_rootNode.childNodes.length) {
i_xmlID = random(xml_rootNode.childNodes.length);
var _local2 = 0;
while (_local2 < a_questionID.length) {
if (a_questionID[_local2] == i_xmlID) {
break;
}
if (_local2 == (a_questionID.length - 1)) {
a_questionID.push(i_xmlID);
_local3 = true;
}
_local2++;
}
if (_local3) {
break;
}
_local1++;
}
} else {
i_xmlID = random(xml_rootNode.childNodes.length);
a_questionID.push(i_xmlID);
}
trace(" xmlID: " + i_xmlID);
trace(" a_quest: " + a_questionID);
root.frage_mc.titel_mc.bt_tf_in.name_tf.text = "FRAGE";
root.frage_mc.frage_tf.autoSize = true;
root.frage_mc.frage_tf.text = xml_rootNode.childNodes[i_xmlID].childNodes[0].firstChild.nodeValue;
var _local1 = 1;
while (_local1 <= 3) {
if (_local1 == 1) {
root.frage_mc.a1_mc.bt_ant.bt_tf_in.name_tf.text = "A";
}
if (_local1 == 2) {
root.frage_mc.a2_mc.bt_ant.bt_tf_in.name_tf.text = "B";
}
if (_local1 == 3) {
root.frage_mc.a3_mc.bt_ant.bt_tf_in.name_tf.text = "C";
}
root.frage_mc[("a" + _local1) + "_mc"].antwort_tf.text = xml_rootNode.childNodes[i_xmlID].childNodes[_local1].firstChild.nodeValue;
root.frage_mc[("a" + _local1) + "_mc"].is = xml_rootNode.childNodes[i_xmlID].childNodes[_local1].attributes.is;
root.frage_mc[("a" + _local1) + "_mc"].i = _local1;
root.frage_mc[("a" + _local1) + "_mc"].i_item = i_item;
_root.menu.f_rollOverOut(root.frage_mc[("a" + _local1) + "_mc"]);
root.frage_mc[("a" + _local1) + "_mc"].onRelease = function () {
var _local1 = this;
if (_local1.is == "true") {
f_questionAnswered(true, _local1.i_item);
} else {
f_questionAnswered(false, _local1.i_item);
}
};
if (xml_rootNode.childNodes[i_xmlID].childNodes[_local1].attributes.is == "true") {
root.frage_mc.s_question = xml_rootNode.childNodes[i_xmlID].childNodes[0].firstChild.nodeValue;
root.frage_mc.s_answer = xml_rootNode.childNodes[i_xmlID].childNodes[_local1].firstChild.nodeValue;
}
_local1++;
}
root.frage_mc.bt_cancel.i_item = i_item;
root.frage_mc.bt_cancel.bt_tf.bt_tf_in.name_tf.text = "Abbruch";
_root.menu.f_rollOverOut(root.frage_mc.bt_cancel);
root.frage_mc.bt_cancel.onRelease = function () {
f_questionDone(this.i_item);
root.frage_mc.removeMovieClip();
};
if (xml_rootNode.childNodes[i_xmlID].childNodes[4].firstChild.nodeValue.length <= 2) {
root.frage_mc.bt_help._visible = false;
}
root.frage_mc.bt_help.bt_tf.bt_tf_in.name_tf.text = "Hinweis";
_root.menu.f_rollOverOut(root.frage_mc.bt_help);
root.frage_mc.bt_help.onRelease = function () {
getURL (xml_rootNode.childNodes[i_xmlID].childNodes[4].firstChild.nodeValue, "_blank");
};
}
function f_questionAnswered(b_answerWas, i_item) {
var _local1 = i_item;
trace((("f_questionAnswered: " + b_answerWas) + " / item: ") + _local1);
var _local2 = ("Richtig! Sie erhalten " + f_getItemValue(_local1)) + " an Energie.";
var _local3 = ((("Leider Falsch! Die Richtige Antwort auf die Frage: \u00BB" + root.frage_mc.s_question) + "\u00AB w\u00E4re \u00BB") + root.frage_mc.s_answer) + "\u00AB gewesen.";
if (b_answerWas) {
s_weiter = _local2;
s_titel = "RICHTIG!";
f_setNrg(f_getItemValue(_local1));
} else {
s_weiter = _local3;
s_titel = "LEIDER FALSCH";
}
root.frage_mc.removeMovieClip();
root.attachMovie("beantwortet_mc", "beantwortet_mc", 1000);
root.beantwortet_mc._x = 30;
root.beantwortet_mc._y = 100;
root.beantwortet_mc.titel_mc.bt_tf_in.name_tf.text = s_titel;
root.beantwortet_mc.weiter_tf.autoSize = true;
root.beantwortet_mc.weiter_tf.text = s_weiter;
root.beantwortet_mc.bt_weiter.bt_tf.bt_tf_in.name_tf.text = "Weiter";
root.beantwortet_mc.bt_weiter.i_item = _local1;
_root.menu.f_rollOverOut(root.beantwortet_mc.bt_weiter);
root.beantwortet_mc.bt_weiter.onRelease = function () {
f_questionDone(this.i_item);
root.beantwortet_mc.removeMovieClip();
};
}
function f_questionDone(i_item) {
if (!b_levelDone) {
f_bucketSwing();
root.bagger_mc.fahrer_ani.play();
root.a_level.splice(i_item, 1);
b_catching = false;
b_stopTime = false;
b_question = false;
_root.b_rotWind = true;
f_playQuestSign();
f_startMwWalkAgain();
}
trace(" yourNrg: " + i_yourNrg);
trace(" maxNrg: " + i_maxNrg);
trace(" a_level: " + root.a_level.length);
if (root.a_level.length == 0) {
f_levelDone();
}
}
function f_levelDone() {
trace("f_levelDone");
f_stopSound("music_backGroundDay");
f_playSound("music_backGroundNight", 9999);
f_stopBucketSwing();
b_levelDone = true;
b_catching = true;
b_stopTime = true;
f_stopMwWalk();
f_removePower();
_root.b_rotWind = false;
root.o_bagger.schaufel_ct.schaufel_mc.gotoAndStop(1);
f_gettingDark(true);
var i_scroll = 216;
var i_move = root.game_ct._y;
var i_nacht = 60;
var i_wait = 0;
root.createEmptyMovieClip("game_emc", 20);
root.game_emc.onEnterFrame = function () {
root.o_level.level._alpha = root.o_level.level._alpha - 5;
if (root.o_level.level._alpha < 0) {
root.o_level.level.removeMovieClip();
}
if (i_wait > 20) {
i_move = f_move(root.game_ct._y, i_scroll, 20, 20);
root.game_ct._y = Math.ceil(i_move);
}
if ((root.game_ct._y >= i_scroll) && (!root.o_level.level)) {
root.game_ct._y = i_scroll;
f_nightLights();
f_sumInit();
this.removeMovieClip();
}
i_wait++;
};
}
function f_nextLevel() {
trace("f_nextLevel");
i_level++;
i_yourNrg = 0;
b_levelDone = false;
_root.b_rotWind = true;
f_gettingDark(false);
root.o_lights._alpha = 0;
f_levelInit();
root.createEmptyMovieClip("game_emc", 20);
root.game_emc.onEnterFrame = function () {
i_move = f_move(root.game_ct._y, -30, 20, 20);
root.game_ct._y = Math.ceil(i_move);
if (root.game_ct._y <= 0) {
root.game_ct._y = 0;
this.removeMovieClip();
}
};
}
function f_levelInit() {
trace("f_levelInit");
trace(" total: " + i_totalNrg);
f_playSound("music_backGroundDay", 9999);
f_stopSound("music_backGroundNight");
i_maxNrg = 0;
var _local2 = "a";
if (random(2) == 1) {
_local2 = "b";
}
var _local3 = ("level_" + i_level) + _local2;
trace(" s_level: " + _local3);
root.a_level = new Array();
root.o_level.attachMovie(("level_" + i_level) + _local2, "level", 100);
f_timeInit(i_timeSet)();
b_stopTime = true;
var i_init = 0;
root.o_level.createEmptyMovieClip("emc_init", 10);
root.o_level.emc_init.onEnterFrame = function () {
i_init++;
if (i_init > 1) {
var _local1 = 0;
while (_local1 < root.a_level.length) {
if (f_getItemTyp(_local1) == "mw") {
f_mwWalk(_local1);
}
i_maxNrg = i_maxNrg + f_getItemValue(_local1);
_local1++;
}
root.o_info.level_tf.textfield_tf.info_tf.text = "LEVEL " + i_level;
i_destNrg = root.o_level.level.i_destNrg;
f_setNrg(i_overNrg);
f_showLevelDestination();
this.removeMovieClip();
}
};
}
function f_showLevelDestination() {
trace("f_showLevelDestination");
root.attachMovie("levelziel_mc", "levelziel_mc", 1000);
root.levelziel_mc._x = 30;
root.levelziel_mc._y = 150;
root.levelziel_mc.titel_mc.bt_tf_in.name_tf.text = "LEVEL " + i_level;
root.levelziel_mc.ziel_tf.autoSize = true;
root.levelziel_mc.ziel_tf.text = ("Sie ben\u00F6tigen mindestens " + i_destNrg) + " Energiepunkte, um die Stadt mit ausreichend Energie zu versorgen.";
root.levelziel_mc.bt_weiter.bt_tf.bt_tf_in.name_tf.text = "LOS GEHTS";
root.levelziel_mc.bt_weiter.i_item = i_item;
_root.menu.f_rollOverOut(root.levelziel_mc.bt_weiter);
root.levelziel_mc.bt_weiter.onRelease = function () {
f_bucketSwing();
b_stopTime = false;
b_catching = false;
root.levelziel_mc.removeMovieClip();
};
}
function f_sumInit() {
trace("f_sumInit");
root.game_ct.attachMovie("summary_mc", "summary_mc", 300);
root.o_sum = root.game_ct.summary_mc;
root.o_sum._y = -210;
var i_lastOverNrg = i_overNrg;
i_overNrg = i_yourNrg - i_destNrg;
var _local1;
var _local2;
var s_button = ("LEVEL " + (i_level + 1));
b_gameOver = false;
i_totalNrg = i_totalNrg + i_yourNrg;
var _local3 = int(((i_yourNrg - i_lastOverNrg) / i_maxNrg) * 100);
root.o_sum.total_tf.text = " ";
root.o_sum.value_tf.text = " ";
trace(" total: " + i_totalNrg);
trace(" max: " + i_maxNrg);
trace(" your: " + i_yourNrg);
trace(" dest: " + i_destNrg);
trace(" over: " + i_overNrg);
if (i_overNrg < 0) {
_local1 = ("LEVEL " + i_level) + " - GAME OVER";
_local2 = "Leider konnte die Stadt nicht mehr mit gen\u00FCgend Energie versorgt werden.";
i_overNrg = 0;
b_gameOver = true;
f_playSound("fx_gameOver");
root.o_sum.total_tf.text = "GESAMTENERGIE:";
root.o_sum.value_tf.text = i_totalNrg;
} else {
f_playSound("fx_levelDone");
if (_local3 < 50) {
_local1 = ("LEVEL " + i_level) + " - GESCHAFFT";
_local2 = "Die stadt wurde ausreichend mit Energie versorgt.";
} else if (_local3 <= 80) {
_local1 = ("LEVEL " + i_level) + " - GESCHAFFT";
_local2 = "Die stadt wurde zur voller zufriedenheit mit Energie versorgt.";
} else if (_local3 > 80) {
_local1 = ("LEVEL " + i_level) + " - GESCHAFFT";
_local2 = "Die Stadt wurde hervorragend mit Energie versorgt";
}
}
if ((!b_gameOver) && (i_level == 10)) {
_local1 = ("LEVEL " + i_level) + " - GESCHAFFT";
_local2 = "Herzlichen Gl\u00FCckwunsch. Sie haben das Spielziel erreicht.";
f_playSound("fx_allDone");
root.o_sum.total_tf.text = "GESAMTENERGIE:";
root.o_sum.value_tf.text = i_totalNrg;
b_gameOver = true;
}
root.o_sum.level_tf.text = _local1.toUpperCase();
root.o_sum.stadt_tf.text = _local2.toUpperCase();
root.o_sum.yourNrg_mc.name_tf.text = "Erziehlte Energie:";
root.o_sum.yourNrg_mc.value_tf.text = i_yourNrg;
root.o_sum.destNrg_mc.name_tf.text = "Energieverbrauch:";
root.o_sum.destNrg_mc.value_tf.text = i_destNrg;
root.o_sum.overNrg_mc.name_tf.text = "Ungenutzte Energie:";
root.o_sum.overNrg_mc.value_tf.text = i_overNrg;
root.o_sum.maxNrg_mc.name_tf.text = "Leveleffizienz:";
root.o_sum.maxNrg_mc.value_tf.text = _local3 + "%";
if (b_gameOver) {
root.o_sum.bt_again.bt_tf.bt_tf_in.name_tf.text = "NOCHMAL SPIELEN";
_root.menu.f_rollOverOut(root.o_sum.bt_again);
root.o_sum.bt_again.onRelease = function () {
f_start();
};
root.o_sum.bt_weiter._x = root.o_sum.bt_weiter._x + 80;
s_button = "GEWINNFORMULAR";
} else {
root.o_sum.bt_again._visible = false;
}
root.o_sum.bt_weiter.bt_tf.bt_tf_in.name_tf.text = s_button.toUpperCase();
_root.menu.f_rollOverOut(root.o_sum.bt_weiter);
root.o_sum.bt_weiter.onRelease = function () {
if (!b_gameOver) {
f_nextLevel();
} else {
f_endGame("f_callForm");
}
root.o_sum.removeMovieClip();
};
}
function f_gettingDark(night) {
trace("f_gettingDark");
var i_destDark = 20;
var i_darker = 100;
var i_gettingDark = -1;
if (!night) {
i_destDark = 100;
i_darker = 20;
i_gettingDark = 5;
}
c_skyNight = new Color(root.game_ct.skyline_mc);
c_earthNight = new Color(root.game_ct.erde_mc);
c_bagger = new Color(root.o_bagger);
root.createEmptyMovieClip("darkness_emc", 99);
root.darkness_emc.onEnterFrame = function () {
i_darker = i_darker + i_gettingDark;
o_colorTransform = new Object();
o_colorTransform = {ra:i_darker, rb:"0", ga:i_darker, gb:"0", ba:i_darker, bb:"0", aa:"100", ab:"0"};
c_skyNight.setTransform(o_colorTransform);
c_earthNight.setTransform(o_colorTransform);
c_bagger.setTransform(o_colorTransform);
if (night && (i_darker < i_destDark)) {
this.removeMovieClip();
}
if ((!night) && (i_darker > i_destDark)) {
this.removeMovieClip();
}
};
}
function f_nightLights() {
trace("f_nightLights");
root.o_lights._alpha = 100;
var i = 0;
while (i < _level0.a_lights.length) {
_level0.a_lights[i]._alpha = 0;
i++;
}
var i_alpha = 100;
var i_max = i_maxNrg;
var i_user = (i_yourNrg - i_overNrg);
var _local3 = i_user / i_max;
if (_local3 >= 1) {
_local3 = 1;
}
trace(((((" i_user/i_max: " + i_user) + " / ") + i_max) + " prozent: ") + _local3);
var i_turnLightsOn = int(_level0.a_lights.length * _local3);
var i = 0;
var i_lightID;
var b_foundNewID = false;
var a_lightsID = new Array();
root.o_lights.createEmptyMovieClip("lights_emc", 10);
root.o_lights.lights_emc.onEnterFrame = function () {
var _local3 = this;
if (i_turnLightsOn > i) {
if (a_lightsID.length > 0) {
var _local2 = 0;
while (_local2 < _level0.a_lights.length) {
i_lightID = random(_level0.a_lights.length);
var _local1 = 0;
while (_local1 < a_lightsID.length) {
if (a_lightsID[_local1] == i_lightID) {
break;
}
if (_local1 == (a_lightsID.length - 1)) {
a_lightsID.push(i_lightID);
b_foundNewID = true;
}
_local1++;
}
if (b_foundNewID) {
b_foundNewID = false;
break;
}
_local2++;
}
} else {
i_lightID = random(_level0.a_lights.length);
a_lightsID.push(i_lightID);
}
_level0.a_lights[i_lightID].createEmptyMovieClip("light_emc", 10);
_level0.a_lights[i_lightID].light_emc.i_lightID = i_lightID;
_level0.a_lights[i_lightID].light_emc.onEnterFrame = function () {
var _local1 = this;
_level0.a_lights[_local1.i_lightID]._alpha = _level0.a_lights[_local1.i_lightID]._alpha + 5;
if (_level0.a_lights[_local1.i_lightID]._alpha > 100) {
_local1.removeMovieClip();
}
};
} else if (b_gameOver) {
i_alpha = i_alpha - 2;
var i = 0;
while (i < a_lightsID.length) {
_level0.a_lights[a_lightsID[i]]._alpha = i_alpha;
i++;
}
if (i_alpha < 0) {
_local3.removeMovieClip();
}
} else {
_local3.removeMovieClip();
}
i++;
};
}
function f_endGame(s_fnc) {
trace("f_endGame");
f_stopAllSounds();
root.game_mask.removeMovieClip();
root.game_ct.removeMovieClip();
root.levelziel_mc.removeMovieClip();
root.vorfrage_mc.removeMovieClip();
root.frage_mc.removeMovieClip();
root.beantwortet_mc.removeMovieClip();
Key.removeListener(root.keyListener);
Mouse.removeListener(root.mouseListener);
_root.menu.i_totalNrg = i_totalNrg;
_root.menu.f_start(s_fnc);
}
function f_timeInit(i_time) {
trace("f_timeInit: " + i_time);
var i = 0;
root.o_info.createEmptyMovieClip("time_emc", 10);
root.o_info.time_emc.onEnterFrame = function () {
if (((i % i_fps) == 0) && (!b_stopTime)) {
i_time--;
root.o_info.time_tf.textfield_tf.info_tf.text = "ZEIT: " + i_time;
if (i_time <= 5) {
f_playSound("fx_timeOut");
}
if (i_time == 0) {
if (!b_levelDone) {
f_levelDone();
}
this.removeMovieClip();
}
}
i++;
};
}
function f_setNrg(i_plusNrg) {
var _local1 = i_plusNrg;
trace("f_setNrg: " + _local1);
i_yourNrg = i_yourNrg + int(_local1);
root.o_info.nrg_tf.textfield_tf.info_tf.text = (("ENERGIE: " + i_yourNrg) + " LEVEL-ZIEL: ") + i_destNrg;
if (_local1 != 0) {
f_playSound("fx_score");
root.o_info.attachMovie("points_mc", "points_mc", 99);
var _local2 = "-";
if (_local1 > 0) {
_local2 = "+";
}
root.o_info.points_mc.points_tf.bt_tf_in.name_tf.text = _local2 + _local1;
}
if (i_yourNrg == (i_maxNrg + i_overNrg)) {
if (!b_question) {
f_levelDone();
}
}
}
function f_cancelGame() {
trace("f_cancelGame");
f_playSound("fx_popUp");
root.attachMovie("abbruch_mc", "abbruch_mc", 1001);
root.abbruch_mc._x = 30;
root.abbruch_mc._y = 150;
root.abbruch_mc.titel_mc.bt_tf_in.name_tf.text = "AKTUELLES SPIEL BEENDEN";
root.abbruch_mc.info_tf.autoSize = true;
root.abbruch_mc.info_tf.text = "M\u00F6chten Sie das aktuelle Spiel abbrechen und zum Hauptmen\u00FC zur\u00FCckkehren?";
root.abbruch_mc.bt_nein.bt_tf.bt_tf_in.name_tf.text = "NEIN";
root.abbruch_mc.bt_nein.i_item = i_item;
_root.menu.f_rollOverOut(root.abbruch_mc.bt_nein);
root.abbruch_mc.bt_nein.onRelease = function () {
root.abbruch_mc.removeMovieClip();
};
root.abbruch_mc.bt_ja.bt_tf.bt_tf_in.name_tf.text = "JA";
root.abbruch_mc.bt_ja.i_item = i_item;
_root.menu.f_rollOverOut(root.abbruch_mc.bt_ja);
root.abbruch_mc.bt_ja.onRelease = function () {
f_endGame("f_callMainNav");
root.abbruch_mc.removeMovieClip();
};
}
function f_getItemTyp(i_item) {
return(root.a_level[i_item].s_itemTyp);
}
function f_getItemValue(i_item) {
return(root.a_level[i_item].s_itemValue);
}
function f_getItemWeight(i_item) {
return(root.a_level[i_item].s_itemWeight);
}
function f_move(objekt, ziel, b1, b2) {
var _local1 = objekt;
var _local2 = ziel;
if (_local2 > _local1) {
_local1 = _local1 + ((_local2 - _local1) / b1);
}
if (_local2 < _local1) {
_local1 = _local1 - ((_local1 - _local2) / b2);
}
return(_local1);
}
var root = this;
var i_fps = 36;
var i_timeSet = 60;
var i_bucketCatchOffset = 25;
var i_catchingSpeed = 7;
var i_rotationSpeed = 2;
var i_power;
var i_destNrg;
var i_maxNrg;
var a_questionID = new Array();
f_loadQuestions();
if (root == _root) {
f_start();
}
stop();
Symbol 28 MovieClip Frame 1
stop();
Symbol 32 MovieClip Frame 1
this._alpha = 0;
Symbol 35 MovieClip Frame 1
stop();
Symbol 43 MovieClip Frame 1
_parent._parent._parent._parent.a_level.push(this);
var s_itemTyp = "bk";
var s_itemValue = 250;
var s_itemWeight = 9;
Symbol 46 MovieClip Frame 1
_parent._parent._parent._parent.a_level.push(this);
var s_itemTyp = "sk";
var s_itemValue = 500;
var s_itemWeight = 10;
Symbol 49 MovieClip Frame 1
_parent._parent._parent._parent.a_level.push(this);
var s_itemTyp = "sk";
var s_itemValue = 100;
var s_itemWeight = 2;
Symbol 52 MovieClip Frame 1
_parent._parent._parent._parent.a_level.push(this);
var s_itemTyp = "sk";
var s_itemValue = 250;
var s_itemWeight = 5;
Symbol 55 MovieClip Frame 1
_parent._parent._parent._parent.a_level.push(this);
var s_itemTyp = "bk";
var s_itemValue = 50;
var s_itemWeight = 1;
Symbol 58 MovieClip Frame 1
_parent._parent._parent._parent.a_level.push(this);
var s_itemTyp = "bk";
var s_itemValue = 125;
var s_itemWeight = 5;
Symbol 59 MovieClip [level_1b] Frame 1
var i_destNrg = 700;
Symbol 100 MovieClip Frame 1
_parent._parent._parent._parent.a_level.push(this);
var s_itemTyp = "kr";
var s_itemValue = 50;
var s_itemWeight = 7;
Symbol 101 MovieClip [level_3b] Frame 1
var i_destNrg = 2100;
Symbol 102 MovieClip [level_3a] Frame 1
var i_destNrg = 2100;
Symbol 103 MovieClip Frame 1
_parent._parent._parent._parent.a_level.push(this);
var s_itemTyp = "fr";
var s_itemValue = 500;
var s_itemWeight = 4;
Symbol 154 MovieClip Frame 1
stop();
Symbol 154 MovieClip Frame 34
f_playSound("fx_meckern");
Symbol 154 MovieClip Frame 208
this._visible = false;
stop();
Symbol 155 MovieClip Frame 1
_parent._parent._parent._parent.a_level.push(this);
var s_itemTyp = "mw";
var s_itemValue = -23;
var s_itemWeight = 5;
Symbol 155 MovieClip Frame 2
stop();
Symbol 156 MovieClip [level_6a] Frame 1
var i_destNrg = 1600;
Symbol 157 MovieClip [level_7b] Frame 1
var i_destNrg = 2000;
Symbol 158 MovieClip [level_8a] Frame 1
var i_destNrg = 2500;
Symbol 159 MovieClip [level_9a] Frame 1
var i_destNrg = 1500;
Symbol 160 MovieClip [level_10a] Frame 1
var i_destNrg = 3000;
Symbol 161 MovieClip [level_10b] Frame 1
var i_destNrg = 3000;
Symbol 162 MovieClip [level_9b] Frame 1
var i_destNrg = 1500;
Symbol 163 MovieClip [level_8b] Frame 1
var i_destNrg = 2500;
Symbol 164 MovieClip [level_7a] Frame 1
var i_destNrg = 2000;
Symbol 165 MovieClip [level_6b] Frame 1
var i_destNrg = 1600;
Symbol 166 MovieClip [level_5b] Frame 1
var i_destNrg = 2900;
Symbol 167 MovieClip [level_5a] Frame 1
var i_destNrg = 2900;
Symbol 168 MovieClip [level_4b] Frame 1
var i_destNrg = 2200;
Symbol 169 MovieClip [level_4a] Frame 1
var i_destNrg = 2200;
Symbol 170 MovieClip [level_2b] Frame 1
var i_destNrg = 1600;
Symbol 171 MovieClip [level_2a] Frame 1
var i_destNrg = 1600;
Symbol 172 MovieClip [level_1a] Frame 1
var i_destNrg = 700;
Symbol 193 MovieClip [button_mc] Frame 1
stop();
Symbol 200 MovieClip Frame 1
stop();
Symbol 224 MovieClip [erde_mc] Frame 1
Symbol 240 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 243 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 246 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 249 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 252 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 255 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 258 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 261 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 264 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 267 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 270 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 273 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 276 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 279 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 282 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 285 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 288 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 291 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 294 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 297 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 300 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 303 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 306 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 309 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 312 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 315 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 318 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 321 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 324 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 327 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 330 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 333 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 336 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 339 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 342 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 345 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 348 MovieClip Frame 1
_level0.a_lights.push(this);
Symbol 350 MovieClip [points_mc] Frame 30
this.removeMovieClip();
Symbol 357 MovieClip [power_mc] Frame 15
stop();