home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Acao / eolica.swf / scripts / frame_14 / DoAction.as
Encoding:
Text File  |  2005-07-26  |  2.6 KB  |  125 lines

  1. GeoCitizen = function(type, game_x, game_y, isFlipped)
  2. {
  3.    if(game_x instanceof MovieClip)
  4.    {
  5.       this.mc = game_x;
  6.       var _loc4_ = GAME.mapScreenToGame(this.mc._x,this.mc._y);
  7.       game_x = _loc4_.game_x;
  8.       game_y = _loc4_.game_y;
  9.    }
  10.    else
  11.    {
  12.       GAME.mc.attachMovie("gc_" + type,"gc" + GAME.drawIndex,GAME.drawIndex);
  13.       this.mc = GAME.mc["gc" + GAME.drawIndex];
  14.       this.id = "gc" + GAME.drawIndex;
  15.    }
  16.    if(game_x == undefined || isNaN(game_x))
  17.    {
  18.       return false;
  19.    }
  20.    this.id = "gc" + GAME.drawIndex;
  21.    this.type = type;
  22.    this.isFlipped = isFlipped;
  23.    this.isPermanent = type == "kiteflyer" || type == "picknicker";
  24.    this.mc.obj = this;
  25.    GAME.drawIndex = GAME.drawIndex + 1;
  26.    this.lastTime = getTimer();
  27.    if(game_x == undefined)
  28.    {
  29.       var _loc5_ = this["getPlacement_" + type];
  30.    }
  31.    this.game_x = Number(game_x);
  32.    this.game_y = Number(game_y);
  33.    GAME.drawOnScreen(this,true);
  34.    if(this.isFlipped)
  35.    {
  36.       this.mc._xscale = - this.mc._xscale;
  37.    }
  38.    GAME.addListener(this);
  39. };
  40. t = GeoCitizen.prototype;
  41. t.mc = false;
  42. t.id = "";
  43. t.type = "";
  44. t.markedForDeath = false;
  45. t.isFlipped = false;
  46. t.age = 0;
  47. t.lastTime = 0;
  48. t.game_x = 0;
  49. t.game_y = 0;
  50. t.min_game_x = 0;
  51. t.max_game_x = 0;
  52. t.enabled = true;
  53. t.maxLifeTime = 10000;
  54. t.hitByWindGust = function(windGust)
  55. {
  56.    if(!this.enabled)
  57.    {
  58.       return true;
  59.    }
  60.    this.mc.gotoAndPlay("hit");
  61.    GAME.adjustScore("hitGeoCitizen_" + this.type,this);
  62. };
  63. t.rePosition = function()
  64. {
  65.    GAME.curGrid.placeInGrid(this,this.game_x,this.game_y);
  66.    GAME.drawOnScreen(this,true);
  67.    if(this.isFlipped)
  68.    {
  69.       this.mc._xscale = - this.mc._xscale;
  70.    }
  71.    this.reBound();
  72. };
  73. t.reBound = function()
  74. {
  75.    var _loc2_ = this.mc.hit_area.getBounds(WM_GAME.mc);
  76.    this.min_game_x = _loc2_.xMin;
  77.    this.max_game_x = _loc2_.xMax;
  78. };
  79. t.onTimeUp = function()
  80. {
  81.    this.hide();
  82. };
  83. t.hide = function()
  84. {
  85.    GAME.removeHitObject(this);
  86.    delete this.mc.onEnterFrame;
  87.    if(this.mc.hide == undefined)
  88.    {
  89.       this.mc.gotoAndPlay("no_hit_hide");
  90.    }
  91.    else
  92.    {
  93.       this.mc.hide();
  94.    }
  95. };
  96. t.remove = function()
  97. {
  98.    this.markedForDeath = true;
  99.    GAME.removeObject(this);
  100. };
  101. t.getPlacement_picknicker = function()
  102. {
  103. };
  104. t.onLevelComplete = function()
  105. {
  106. };
  107. t.onLevelIncomplete = function()
  108. {
  109. };
  110. t.onLevelEnter = function()
  111. {
  112.    if(!this.isPermanent)
  113.    {
  114.       this.hide();
  115.    }
  116. };
  117. t.onNextLevel = function()
  118. {
  119.    this.hide();
  120. };
  121. t.toString = function()
  122. {
  123.    return "[GeoCitizen " + this.type + "]";
  124. };
  125.