home *** CD-ROM | disk | FTP | other *** search
- WindGust = function(game_x, game_y, isJetStream)
- {
- GAME.mc.attachMovie(!isJetStream ? "wind_gust" : "wind_gust_jetstream","wind_gust" + GAME.drawIndex,GAME.drawIndex);
- this.mc = GAME.mc["wind_gust" + GAME.drawIndex];
- this.mc.obj = this;
- GAME.drawIndex = GAME.drawIndex + 1;
- this.game_x = game_x;
- this.game_y = game_y;
- GAME.drawOnScreen(this,true);
- this.setStatus(1);
- this.onGameFrame = function()
- {
- this.loop();
- };
- GAME.addListener(this);
- GAME.gameFrame.addListener(this);
- };
- var t = WindGust.prototype;
- t.loop = function()
- {
- this.updatePosition();
- if(this.curStatusLoop() == false)
- {
- return false;
- }
- GAME.drawOnScreen(this,true);
- };
- t.status1Loop = function()
- {
- if(this.game_y > GAME.parameters.windGustTooFarY)
- {
- this.mc.gotoAndPlay("too_far");
- this.setStatus(3);
- return false;
- }
- var _loc8_ = this.curCell;
- this.curCell = GAME.curGrid.mapCell(this.game_x,this.game_y);
- var _loc7_ = new Array(this.curCell);
- if(_loc8_ != this.curCell)
- {
- _loc7_.push(_loc8_);
- }
- this.mc.cell_out = this.curCell;
- var _loc6_ = 0;
- while(_loc6_ < _loc7_.length)
- {
- var _loc4_ = _loc7_[_loc6_];
- if(_loc4_.contents.length > 0)
- {
- }
- var _loc3_ = 0;
- while(_loc3_ < _loc4_.contents.length)
- {
- var _loc2_ = _loc4_.contents[_loc3_];
- if(_loc2_.game_y >= this.last_y && _loc2_.game_y <= this.game_y && this.game_x <= _loc2_.max_game_x && this.game_x >= _loc2_.min_game_x)
- {
- var _loc5_ = _loc2_.hitByWindGust(this);
- if(!_loc5_)
- {
- this.burst(_loc2_);
- return false;
- }
- }
- _loc3_ = _loc3_ + 1;
- }
- _loc6_ = _loc6_ + 1;
- }
- };
- t.status2Loop = function()
- {
- if(this.game_y > GAME.parameters.windGustTooFarY)
- {
- this.mc.gotoAndPlay("too_far");
- this.setStatus(3);
- return false;
- }
- };
- t.status3Loop = function()
- {
- };
- t.burst = function(hitObj)
- {
- this.setStatus(3);
- GAME.gameFrame.removeListener(this);
- delete this.loop;
- this.mc.gotoAndPlay("burst");
- this.game_y = hitObj.game_y;
- GAME.drawOnScreen(this,true);
- var _loc2_ = hitObj.mc.getDepth();
- _loc2_ += 10;
- this.mc.swapDepths(_loc2_);
- };
- t.remove = function()
- {
- this.markedForDeath = true;
- GAME.gameFrame.removeListener(this);
- GAME.removeObject(this);
- };
- t.fadeAway = function()
- {
- this.mc.gotoAndPlay("too_far");
- };
- t.updatePosition = function()
- {
- this.last_y = this.game_y;
- this.game_x += GAME.windAdjustX;
- this.game_y += this.speed + GAME.windAdjustY;
- };
- t.setStatus = function(status)
- {
- this.status = status;
- this.curStatusLoop = this["status" + status + "Loop"];
- };
- t.createTrail = function()
- {
- GAME.mc.attachMovie("wind_gust_trail","wgt" + GAME.drawIndex,this.mc.getDepth() + 1,{_x:this.mc._x,_y:this.mc._y,_xscale:this.mc._xscale,_yscale:this.mc._yscale});
- GAME.drawIndex = GAME.drawIndex + 1;
- };
- t.onLevelComplete = function()
- {
- this.fadeAway();
- };
- t.onLevelIncomplete = function()
- {
- this.fadeAway();
- };
- t.mc = false;
- t.markedForDeath = false;
- t.speed = 35;
- t.power = 10;
- t.last_x = 0;
- t.game_x = 0;
- t.game_y = 0;
- t.curCell = false;
- t.status = 0;
- t.statusLoop = false;
- t.toString = function()
- {
- return "[WindGust " + this.game_x + "," + this.game_y + "]";
- };
-