home *** CD-ROM | disk | FTP | other *** search
- GAME = new Object();
- GAME.mc = false;
- GAME.interface_mc = this;
- AsBroadcaster.initialize(GAME);
- _global.WM_GAME = GAME;
- t = GAME;
- t.init = function()
- {
- this.curGrid = new Grid(1,24,1000,50,GAME.interface_mc.grid_mc);
- this.changeWindDirection(0);
- this.init3D();
- this.mc = this.interface_mc.viewport_mc;
- this.broadcastMessage("onGameInit");
- this.gotoLevel(1);
- this.gameSecond.addListener(this);
- };
- t.loop = function()
- {
- switch(this.status)
- {
- case 0:
- case 1:
- break;
- case 2:
- this.gameTimeElapsed += (getTimer() - this.lastTime) / 1000;
- this.gameFramesElapsed = this.gameFramesElapsed + 1;
- this.interface_mc.timeelasped_out = this.gameTimeElapsed;
- this.lastTime = getTimer();
- this.checkTimers();
- this.cleanListener();
- }
- };
- t.deathMarker = 0;
- t.cleanListener = function()
- {
- if(this.deathMarker >= this._listeners.length)
- {
- this.deathMarker = 0;
- }
- var _loc3_ = this._listeners[this.deathMarker];
- if(_loc3_ == undefined || typeof _loc3_ == "movieclip" && _loc3_._name == undefined || _loc3_.markedForDeath)
- {
- this._listeners.splice(this.deathMarker,1);
- }
- else
- {
- this.deathMarker = this.deathMarker + 1;
- }
- _root.test_num_listeners = this._listeners.length;
- };
- t.mouseDownHandler = function()
- {
- if(this.status == 2)
- {
- this.curBellows.blowWindGust();
- this.broadcastMessage("onGameMouseDown");
- }
- };
- t.mouseUpHandler = function()
- {
- if(this.status == 2)
- {
- this.broadcastMessage("onGameMouseUp");
- }
- };
- t.mouseOverHandler = function()
- {
- this.isMouseOver = true;
- if(this.status == 3)
- {
- }
- if(this.status == 2)
- {
- this.broadcastMessage("onGameMouseOver");
- }
- };
- t.mouseOutHandler = function()
- {
- this.isMouseOver = false;
- if(this.status == 2)
- {
- this.broadcastMessage("onGameMouseOut");
- }
- };
- t.curBellows = false;
- t.hitObjects = new Array();
- t.windGusts = new Array();
- t.windMills = new Array();
- t.lights = new Array();
- t.lights._off = new Array();
- t.lights._on = new Array();
- t.regBellows = function(mc)
- {
- if(this.curBellows == false)
- {
- this.curBellows = new Bellows(mc);
- }
- };
- t.regWindMill = function(mc)
- {
- var _loc2_ = new WindMill(mc);
- this.windMills.push(_loc2_);
- this.addHitObject(_loc2_);
- };
- t.curGenerators = new Array();
- t.regGenerator = function(mc, type)
- {
- if(mc.mode_p.toLowerCase() == "slave")
- {
- var _loc3_ = this.curGenerators[type];
- if(_loc3_ == undefined)
- {
- this.regLimbo[type + "_slave"];
- }
- else
- {
- _loc3_.addSlave(mc);
- }
- }
- else
- {
- _loc3_ = new Generator(mc,type);
- this.curGenerators[type] = _loc3_;
- var _loc4_ = this.regLimbo[type + "_slave"];
- if(_loc4_ != undefined)
- {
- _loc3_.addSlave(_loc4_);
- }
- }
- };
- t.clearGenerators = function()
- {
- while(this.curGenerators.length > 0)
- {
- var _loc2_ = this.curGenerators.pop();
- _loc2_.remove();
- }
- };
- t.curWindGenerator = false;
- t.regWindGenerator = function(mc)
- {
- var _loc1_ = new WindGenerator(mc);
- };
- t.createJetStreamIcon = function(game_x, game_y)
- {
- var _loc2_ = new JetStreamIcon(game_x,game_y);
- this.addHitObject(_loc2_);
- };
- t.regGeoCitizen = function(type, mc)
- {
- var _loc2_ = new GeoCitizen(type,mc);
- this.addHitObject(_loc2_);
- };
- t.createGeoCitizen = function(type, game_x, game_y, isFlipped)
- {
- var _loc2_ = new GeoCitizen(type,game_x,game_y,isFlipped);
- this.addHitObject(_loc2_);
- };
- t.regLight = function(mc)
- {
- this.lights.push(mc);
- this.lights._off.push(mc);
- };
- t.addHitObject = function(obj)
- {
- var _loc4_ = this.hitObjects.push(obj) - 1;
- this.hitObjects[obj.id] = _loc4_;
- this.curGrid.placeInGrid(obj,obj.game_x,obj.game_y);
- var _loc3_ = obj.mc.hit_area.getBounds(this.mc);
- obj.min_game_x = _loc3_.xMin;
- obj.max_game_x = _loc3_.xMax;
- };
- t.removeHitObject = function(obj)
- {
- var _loc3_ = this.hitObjects[obj.id];
- this.hitObjects.splice(_loc3_,1);
- this.curGrid.removeFromGrid(obj);
- delete this.hitObjects[obj.id];
- };
- t.curEnergyMeter = false;
- t.curTimer = false;
- t.curWindGauge = false;
- t.curScoreDisplay = false;
- t.curJetStreamTimer = false;
- t.curLevelDisplay = false;
- t.regWindMillGauge = function(mc)
- {
- var _loc4_ = mc._name.substring(0,mc._name.indexOf("_gauge"));
- var _loc3_ = this.mc[_loc4_].obj;
- if(_loc3_ != undefined)
- {
- _loc3_.gauge_mc = mc;
- }
- else
- {
- this.regLimbo[mc._name] = mc;
- }
- };
- t.regWindGauge = function(mc)
- {
- this.curWindGauge = new WindGauge(mc);
- };
- t.regEnergyMeter = function(mc)
- {
- this.curEnergyMeter = new EnergyMeter(mc);
- };
- t.regTimer = function(mc)
- {
- this.curTimer = new Timer(mc);
- };
- t.regScoreDisplay = function(mc)
- {
- this.curScoreDisplay = new ScoreDisplay(mc);
- };
- t.regJetStreamTimer = function(mc)
- {
- this.curJetStreamTimer = new JetStreamTimer(mc);
- };
- t.regLevelDisplay = function(mc)
- {
- this.curLevelDisplay = mc;
- };
- t.jetStreamEnabled = false;
- t.turnOnJetStream = function()
- {
- this.jetStreamEnabled = true;
- this.curBellows.turnOnJetStream();
- this.curJetStreamTimer.start(5);
- };
- t.turnOffJetStream = function()
- {
- this.jetStreamEnabled = false;
- this.curBellows.turnOffJetStream();
- this.curJetStreamTimer.stop();
- };
- t.windDirection = 0;
- t.windSpeed = 4;
- t.windAdjustX = 0;
- t.windAdjustY = 0;
- t.changeWindDirection = function(direction)
- {
- this.windDirection = Number(direction);
- var _loc2_ = direction / 57.29577951308232;
- this.windAdjustX = Math.sin(_loc2_) * this.windSpeed;
- this.windAdjustY = Math.cos(_loc2_) * this.windSpeed;
- this.broadcastMessage("onWindDirectionChange",this.windDirection);
- };
- t.score = 0;
- t.setScore = function(amount)
- {
- this.score = amount;
- this.curScoreDisplay.showScore(this.score);
- };
- t.adjustScore = function(amount, caller)
- {
- if(typeof amount == "string")
- {
- amount = this.parameters.points[amount];
- }
- this.score += amount;
- if(this.score < 0)
- {
- this.score = 0;
- }
- this.curScoreDisplay.showScore(this.score);
- this.checkScore();
- if(caller != undefined)
- {
- this.showPoints(amount,caller);
- }
- };
- t.showPoints = function(amount, caller)
- {
- var _loc5_ = amount <= 0 ? "neg" : "pos";
- this.interface_mc.point_dest.attachMovie("point_" + _loc5_ + "_ani","p" + GAME.drawIndex,GAME.drawIndex);
- var _loc4_ = this.interface_mc.point_dest["p" + GAME.drawIndex];
- GAME.drawIndex = GAME.drawIndex + 1;
- _loc4_.text = _loc5_ != "pos" ? "" : "+";
- _loc4_.text += String(amount);
- if(caller.mc.point_marker != undefined)
- {
- var _loc3_ = {x:caller.mc.point_marker._x,y:caller.mc.point_marker._y};
- caller.mc.localToGlobal(_loc3_);
- GAME.mc.localToGlobal(_loc3_);
- var _loc7_ = _loc3_.x;
- var _loc6_ = _loc3_.y;
- }
- else
- {
- _loc7_ = caller.mc._x;
- _loc6_ = caller.mc._y;
- }
- _loc4_._x = _loc7_;
- _loc4_._y = _loc6_;
- };
- t.checkScore = function()
- {
- };
- t.levels = new Array(false);
- t.curLevel = false;
- t.onCurLevelEnterComplete = function()
- {
- this.broadcastMessage("onLevelEnter",this.curLevel);
- this.interface_mc.ready_set_mc.gotoAndPlay("show");
- };
- t.curLevelStart = function()
- {
- this.setStatus(2);
- this.broadcastMessage("onLevelStart",this.curLevel);
- };
- t.addLevel = function(a)
- {
- var _loc2_ = new Level(a);
- var _loc3_ = this.levels.push(_loc2_) - 1;
- this.levels[a.id] = _loc2_;
- _loc2_.num = _loc3_;
- };
- t.gotoLevel = function(id)
- {
- this.curLevel = this.levels[id];
- this.clearGenerators();
- this.mc.gotoAndPlay(this.curLevel.id);
- this.setStatus(1);
- this.broadcastMessage("onLevelEnterStart",this.curLevel);
- this.curLevelDisplay.gotoAndPlay(this.curLevel.id);
- };
- t.restartCurLevel = function()
- {
- this.curPower = 0;
- this.interface_mc.ready_set_mc.gotoAndPlay("show");
- _global.gChangeLevel = false;
- this.setStatus(1);
- this.broadcastMessage("onLevelRestart",this.curLevel);
- this.broadcastMessage("onLevelEnter",this.curLevel);
- };
- t.repeatLevel = t.restartCurLevel;
- t.nextLevel = function()
- {
- this.gotoLevel(this.curLevel.num + 1);
- this.broadcastMessage("onNextLevel");
- };
- t.curLevelComplete = function()
- {
- Audio.play("geo_wind_levelup_1_snd");
- this.broadcastMessage("onLevelComplete",this.curLevel);
- if(STAND_ALONE)
- {
- this.interface_mc.temp_completer.gotoAndPlay("show");
- }
- else
- {
- _global.gUser.geoscore = parseInt(_global.gUser.geoscore,10) + parseInt(this.score,10);
- _global.gChangeLevel = true;
- _global.gGameLevelIsComplete = true;
- if(this.curLevel.id == "level5")
- {
- _global.trackNavClick("Island.Game2.Gamecomplete");
- }
- else
- {
- _global.trackNavClick("Island.Game2.Levelcomplete");
- }
- }
- this.setScore(0);
- this.setStatus(1);
- };
- t.timeOut = function()
- {
- this.broadcastMessage("onLevelIncomplete",this.curLevel);
- if(STAND_ALONE)
- {
- this.interface_mc.temp_incompleter.gotoAndPlay("show");
- }
- else
- {
- _global.gChangeLevel = true;
- _global.gGameLevelIsComplete = false;
- _global.trackNavClick("Island.Game2.Timesup");
- }
- this.setScore(0);
- this.setStatus(1);
- };
- t.isPaused = false;
- t.pause = function()
- {
- this.setStatus(3);
- this.isPaused = true;
- this.broadcastMessage("onGamePause",this.curLevel);
- this.interface_mc.pauser_mc.gotoAndPlay("show");
- };
- t.unpause = function()
- {
- this.setStatus(2);
- this.isPaused = false;
- this.broadcastMessage("onGameUnpause",this.curLevel);
- this.interface_mc.pauser_mc.gotoAndPlay("hide");
- };
- t.setYOrigin = function(screen_y)
- {
- this.yOrigin = screen_y;
- };
- t.curEnergy = 0;
- t.getCurEnergyOutput = function()
- {
- var _loc4_ = 0;
- var _loc2_ = 0;
- while(_loc2_ < this.windMills.length)
- {
- var _loc3_ = this.windMills[_loc2_];
- _loc4_ += _loc3_.energyOutput;
- _loc2_ = _loc2_ + 1;
- }
- return _loc4_;
- };
- t.setStatus = function(status)
- {
- if(status == 2)
- {
- this.lastTime = getTimer();
- }
- this.status = status;
- };
- t.removeObject = function(obj)
- {
- this.removeHitObject(this);
- removeMovieClip(obj.mc);
- };
- t.drawIndex = 1;
- t.yArray = false;
- t.maxWindGusts = 0;
- t.yOrigin = 0;
- t.curGrid = false;
- t.isMouseOver = false;
- t.lastTime = getTimer();
- t.gameTimeElapsed = 0;
- t.gameFramesElapsed = 0;
- t.status = 0;
- t.regLimbo = new Object();
- t.parameters = {minWindMillMPH:15,maxWindMillMPH:55,maxEnergyPerWindMill:4,globalFriction:0.998,energyConversion:1,windGustTooFarY:1200,points:{hitWindMill:100,windMillOverload:-200,timerSecond:20,hitGeoCitizen_picknicker:-200,hitGeoCitizen_windboarder:200,hitGeoCitizen_hangglider:200,hitGeoCitizen_kiteflyer:-200}};
-