home *** CD-ROM | disk | FTP | other *** search
- class Item4 extends MovieClip
- {
- var collected = false;
- function Item4()
- {
- super();
- }
- function onLoad()
- {
- var _loc1_ = this;
- var tmpArr = _loc1_._name.split("_");
- var id = Number(tmpArr[1]);
- var _loc3_ = _loc1_._parent.itemPoints[4][id].split(":");
- _loc1_._x = _loc3_[0] * _loc1_._parent.cellsize;
- _loc1_._y = _loc3_[1] * _loc1_._parent.cellsize;
- _loc1_.xCell = Math.floor(_loc1_._x / _loc1_._parent.cellsize + 0.5);
- _loc1_.yCell = Math.floor(_loc1_._y / _loc1_._parent.cellsize + 0.5);
- var _loc2_ = _loc1_._parent.cells[_loc1_.xCell][_loc1_.yCell].gravType;
- if(_loc2_ <= 4)
- {
- if(_loc2_ == 0)
- {
- _loc2_ = 1;
- }
- _loc1_._rotation = 90 * (_loc2_ - 1);
- }
- else
- {
- _loc1_._rotation = 90 * (_loc2_ - 1) + 45;
- }
- _loc1_.createEmptyMovieClip("sprite",1);
- _loc1_.sprite.attachMovie("item4_1","sprite",1);
- }
- function onEnterFrame()
- {
- var _loc1_ = this;
- var _loc2_ = _root;
- if(_loc1_._parent.cells[_loc1_.xCell][_loc1_.yCell].clip == undefined)
- {
- §§push(_loc1_.removeMovieClip());
- }
- if(_loc1_.sprite.sprite.hitarea.hitTest(_loc1_._parent.player) && _loc1_._parent.cells[_loc1_.xCell][_loc1_.yCell].itemAlive)
- {
- _loc2_.score += 250;
- _loc1_._parent.cells[_loc1_.xCell][_loc1_.yCell].itemAlive = false;
- _loc2_.secretsFound[0] = true;
- _loc2_.attachMovie("Message","msg",5);
- _loc2_.msg.msgText = "You\'ve found the Bunny Mask!";
- _loc2_.kongregateStats.submit("Secret1",1);
- _loc1_.soundFX = new Sound(_loc1_);
- _loc1_.soundFX.attachSound("collect_secret");
- _loc1_.soundFX.start(0,0);
- _loc1_.soundFX.setVolume(80);
- _loc1_.collected = true;
- }
- if(!_loc1_._parent.cells[_loc1_.xCell][_loc1_.yCell].itemAlive)
- {
- _loc1_._alpha += (- _loc1_._alpha) / 3;
- _loc1_._xscale += (150 - _loc1_._xscale) / 3;
- _loc1_._yscale = _loc1_._xscale;
- if(_loc1_._alpha < 5)
- {
- §§push(_loc1_.removeMovieClip());
- }
- }
- }
- }
-