home *** CD-ROM | disk | FTP | other *** search
- package
- {
- import flash.display.*;
- import flash.events.*;
- import flash.text.*;
- import flash.utils.*;
-
- [Embed(source="/_assets/assets.swf", symbol="MonsterGenerator")]
- public class MonsterGenerator extends MovieClip
- {
-
-
- public var monsterType:int;
-
- public var timer:Timer;
-
- public var emitting:Boolean;
-
- public var monsterCount:int;
-
- public var col:int;
-
- public var precursor:Boolean;
-
- public var maxMonster:int;
-
- public var row:int;
-
- public var game:PlatformGame;
-
- public function MonsterGenerator(param1:PlatformGame)
- {
- super();
- addFrameScript(0,frame1,3,frame4);
- game = param1;
- }
-
- internal function init() : *
- {
- var _loc1_:int = 0;
- precursor = false;
- _loc1_ = 0;
- switch(monsterType)
- {
- case 22:
- maxMonster = 2;
- _loc1_ = 10000;
- break;
- case 25:
- maxMonster = 1;
- _loc1_ = 7000;
- break;
- default:
- maxMonster = 2;
- _loc1_ = 10000;
- }
- emitting = true;
- monsterCount = 0;
- timer = new Timer(_loc1_ + Math.random() * 2000,0);
- timer.start();
- timer.addEventListener(TimerEvent.TIMER,emit);
- }
-
- public function resetTimer() : *
- {
- timer.reset();
- timer.start();
- }
-
- internal function frame1() : *
- {
- stop();
- }
-
- internal function frame4() : *
- {
- stop();
- }
-
- public function emit(param1:Event) : *
- {
- if(monsterCount >= maxMonster || !emitting)
- {
- return;
- }
- if(monsterType == 22)
- {
- game.sounds.snakespawn.play();
- }
- game.createMonster(monsterType,col,row,this);
- ++monsterCount;
- }
- }
- }
-