home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Nave / rocket_rush.swf / scripts / __Packages / Layout.as < prev    next >
Encoding:
Text File  |  2007-03-20  |  1.0 KB  |  36 lines

  1. class Layout extends Object
  2. {
  3.    var player_clip;
  4.    var enemies = [];
  5.    var enemy_types = [];
  6.    var enemy_selection = 1;
  7.    function Layout(p_player_clip)
  8.    {
  9.       super();
  10.       this.enemies = [];
  11.       this.player_clip = p_player_clip;
  12.    }
  13.    function addEnemy(p_enemy_clip, p_pos_x, p_pos_y, p_pos_z)
  14.    {
  15.       this.enemies.push(new Enemy(p_enemy_clip,p_pos_x,p_pos_y,p_pos_z));
  16.    }
  17.    function generateEnemies()
  18.    {
  19.       var _loc2_ = 1500;
  20.       while(_loc2_ < 25000)
  21.       {
  22.          _loc2_ += 500 + Math.round(Math.random() * 100);
  23.          if(_loc2_ > 5000 & this.enemy_selection == 1)
  24.          {
  25.             this.enemy_selection = 2;
  26.          }
  27.          if(_loc2_ > 14000 & this.enemy_selection == 2)
  28.          {
  29.             this.enemy_selection = 3;
  30.          }
  31.          var _loc3_ = this.enemy_types[Math.floor(Math.random() * this.enemy_selection)];
  32.          this.addEnemy(_loc3_,Math.round(Math.random() * 2000 - 1000),Math.round(Math.random() * 2000 - 1000),_loc2_);
  33.       }
  34.    }
  35. }
  36.