home *** CD-ROM | disk | FTP | other *** search
- class HUD extends MovieClip
- {
- var possible_items;
- var held_items;
- var descriptions;
- var info;
- var infos;
- var tbar;
- var slot3;
- var onEnterFrame;
- function HUD()
- {
- super();
- AsBroadcaster.initialize(this);
- this.possible_items = ["blank","rain_disk","sun_disk","snow_disk","thunder_disk","special_disk"];
- this.possible_items.push("small_shell","large_shell","bucket_spade","gold_watch","umbrella");
- this.possible_items.push("voucher","map_poster","souvenir_hat","hula_doll","head_dress");
- this.possible_items.push("blank","scale_1","scale_2","scale_3","scale_4","scale_5");
- this.held_items = ["blank","blank","blank","blank"];
- this.descriptions = {};
- this.descriptions.blank = "";
- this.descriptions.rain_disk = "A mysterious stone disk with a rain design";
- this.descriptions.sun_disk = "A mysterious stone disk with a sun design";
- this.descriptions.snow_disk = "A mysterious stone disk with a snow design";
- this.descriptions.thunder_disk = "A mysterious stone disk with a lightning design";
- this.descriptions.special_disk = "A souvenir stone disk with an awesome design";
- this.descriptions.small_shell = "A small sea shell";
- this.descriptions.large_shell = "A regular sea shell";
- this.descriptions.bucket_spade = "A seaside bucket and spade";
- this.descriptions.gold_watch = "A priceless antique gold watch";
- this.descriptions.umbrella = "A pink umbrella";
- this.descriptions.voucher = "A gift shop voucher";
- this.descriptions.map_poster = "A souvenir poster print of an old map";
- this.descriptions.souvenir_hat = "A souvenir tropical cap";
- this.descriptions.hula_doll = "A souvenir dancing hula doll";
- this.descriptions.head_dress = "A tribal head-dress";
- this.descriptions.scale_1 = "An oddly shaped glittering scale";
- this.descriptions.scale_2 = "An oddly shaped glittering scale";
- this.descriptions.scale_3 = "An oddly shaped glittering scale";
- this.descriptions.scale_4 = "An oddly shaped glittering scale";
- this.descriptions.scale_5 = "An oddly shaped glittering scale";
- var _loc3_ = 0;
- while(_loc3_ < 4)
- {
- this.setItem("blank",_loc3_);
- this["slot" + _loc3_].onRelease = function()
- {
- if(this._parent.possible_items[this._currentframe] == "map_poster")
- {
- Story.lookAtMap();
- }
- else
- {
- this._parent.broadcastMessage("useItem",this._parent.possible_items[this._currentframe]);
- }
- };
- this["slot" + _loc3_].onRollOver = function()
- {
- this._parent.setText(this._parent.descriptions[this._parent.possible_items[this._currentframe]]);
- };
- this["slot" + _loc3_].onRollOut = function()
- {
- this._parent.setText("");
- };
- _loc3_ = _loc3_ + 1;
- }
- }
- function returnItems()
- {
- var _loc2_ = [];
- for(var _loc3_ in this.held_items)
- {
- _loc2_[_loc3_] = this.held_items[_loc3_];
- }
- return _loc2_;
- }
- function updateItems(p_items)
- {
- var _loc2_ = 0;
- while(_loc2_ < 4)
- {
- this.setItem(p_items[_loc2_],_loc2_);
- _loc2_ = _loc2_ + 1;
- }
- }
- function setText(p_text)
- {
- this.info.text = p_text;
- this.infos.text = p_text;
- if(p_text == "" || p_text == undefined)
- {
- this.tbar._visible = false;
- }
- else
- {
- this.tbar._visible = true;
- }
- }
- function setPhoto()
- {
- var _loc2_ = "Take photo of " + this.checkPhoto();
- this.setText(_loc2_);
- }
- function checkPhoto()
- {
- if(_root.e == undefined)
- {
- return "the tutorial";
- }
- if(_root.e.hit_center != _root)
- {
- return _root.e.hit_center.photo_name;
- }
- return "the ground";
- }
- function pickupItem(item)
- {
- var _loc2_ = 0;
- while(_loc2_ < 4)
- {
- if(this.held_items[_loc2_] == "blank")
- {
- this.setItem(item,_loc2_);
- return true;
- }
- _loc2_ = _loc2_ + 1;
- }
- this.setText("Inventory Full");
- return false;
- }
- function hasItem(p_item)
- {
- var _loc2_ = 0;
- while(_loc2_ < 4)
- {
- if(this.held_items[_loc2_] == p_item)
- {
- return true;
- }
- _loc2_ = _loc2_ + 1;
- }
- return false;
- }
- function usedItem(item)
- {
- var _loc3_ = -1;
- var _loc2_ = 0;
- while(_loc2_ < 4)
- {
- if(this.held_items[_loc2_] == item)
- {
- _loc3_ = _loc2_;
- }
- _loc2_ = _loc2_ + 1;
- }
- if(_loc3_ == -1)
- {
- return false;
- }
- _loc2_ = _loc3_;
- while(_loc2_ < 3)
- {
- this.setItem(this.held_items[_loc2_ + 1],_loc2_);
- _loc2_ = _loc2_ + 1;
- }
- this.held_items[3] = "blank";
- this.slot3.gotoAndStop("blank");
- return true;
- }
- function setItem(item, position)
- {
- this.held_items[position] = item;
- if(item == "blank")
- {
- this["slot" + position].gotoAndStop("blank");
- }
- else
- {
- this["slot" + position].gotoAndStop(item);
- this["slot" + position]._xscale = this["slot" + position]._yscale = 0;
- this["slot" + position].onEnterFrame = function()
- {
- this._xscale = this._yscale += 30;
- if(this._xscale > 58.1)
- {
- this._xscale = this._yscale = 58.1;
- this.onEnterFrame = function()
- {
- };
- }
- };
- }
- }
- }
-