mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-19 09:37:50 -05:00
Brought up to date with the private repository (feea4c7)
This commit is contained in:
1 parent
1aa738d692
commit
1b1df1ae48
7925 files changed
+2617237
-20
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,301 @@
|
||||
package game.towerDefense
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.Event;
|
||||
import flash.geom.Point;
|
||||
|
||||
public class TowerDefenseEnemy
|
||||
{
|
||||
|
||||
public static const STATE_MOVE:int = 0;
|
||||
|
||||
public static const STATE_ROTATE:int = 1;
|
||||
|
||||
public var _type:int;
|
||||
|
||||
public var _hitPoints:int;
|
||||
|
||||
public var _pathIndex:int;
|
||||
|
||||
public var _distanceTraveled:Number;
|
||||
|
||||
public var _speed:Number;
|
||||
|
||||
public var _path:Array;
|
||||
|
||||
public var _moveDirection:Point;
|
||||
|
||||
public var _currentTilePos:Point;
|
||||
|
||||
public var _theGame:TowerDefense;
|
||||
|
||||
public var _clone:Object;
|
||||
|
||||
public var _state:int;
|
||||
|
||||
public var _targetRotation:int;
|
||||
|
||||
public var _healthBar:Object;
|
||||
|
||||
public var _waitingForRecycle:Boolean;
|
||||
|
||||
public var _loadComplete:Boolean;
|
||||
|
||||
public function TowerDefenseEnemy(param1:TowerDefense)
|
||||
{
|
||||
super();
|
||||
_theGame = param1;
|
||||
_moveDirection = new Point();
|
||||
_currentTilePos = new Point();
|
||||
}
|
||||
|
||||
public function init(param1:int, param2:int, param3:Number) : void
|
||||
{
|
||||
var _loc4_:int = 0;
|
||||
_pathIndex = 0;
|
||||
_path = _theGame._paths[_theGame._pathIndex];
|
||||
if(!_loadComplete)
|
||||
{
|
||||
_clone = _theGame.getScene().cloneAsset("enemy");
|
||||
_clone.loader.contentLoaderInfo.addEventListener("complete",enemyLoadComplete);
|
||||
}
|
||||
_type = param1;
|
||||
_hitPoints = param2;
|
||||
_speed = param3;
|
||||
_distanceTraveled = 0;
|
||||
_waitingForRecycle = false;
|
||||
setCurrentTilePos();
|
||||
if(_path[0] == 0 || _path[0] == 13 || _path[0] == 126 || _path[0] == 139)
|
||||
{
|
||||
_loc4_ = _path[1] - _path[0];
|
||||
}
|
||||
else if(_path[0] % 14 == 0)
|
||||
{
|
||||
_loc4_ = 1;
|
||||
}
|
||||
else if(_path[0] < 14)
|
||||
{
|
||||
_loc4_ = 14;
|
||||
}
|
||||
else if(_path[0] % 14 == 13)
|
||||
{
|
||||
_loc4_ = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc4_ = -14;
|
||||
}
|
||||
switch(_loc4_)
|
||||
{
|
||||
case 1:
|
||||
_clone.loader.x = -50;
|
||||
_clone.loader.y = Math.floor(_path[0] / 14) * 50;
|
||||
break;
|
||||
case -1:
|
||||
_clone.loader.x = 700;
|
||||
_clone.loader.y = Math.floor(_path[0] / 14) * 50;
|
||||
break;
|
||||
case 14:
|
||||
_clone.loader.x = _path[0] % 14 * 50;
|
||||
_clone.loader.y = -50;
|
||||
break;
|
||||
case -14:
|
||||
_clone.loader.x = _path[0] % 14 * 50;
|
||||
_clone.loader.y = 500;
|
||||
break;
|
||||
default:
|
||||
throw new Error("Invalid path data");
|
||||
}
|
||||
_state = 0;
|
||||
if(_loadComplete)
|
||||
{
|
||||
enemyLoadComplete(null);
|
||||
}
|
||||
}
|
||||
|
||||
public function enemyLoadComplete(param1:Event) : void
|
||||
{
|
||||
var _loc2_:MovieClip = _clone.loader.content;
|
||||
_theGame.getScene().getLayer("healthbar").loader.x = 0;
|
||||
_theGame.getScene().getLayer("healthbar").loader.y = 0;
|
||||
_loc2_.enemyType(_type);
|
||||
if(_healthBar == null)
|
||||
{
|
||||
_healthBar = _theGame.getScene().cloneAsset("healthbar");
|
||||
_healthBar.loader.contentLoaderInfo.addEventListener("complete",healthBarLoadComplete);
|
||||
_loc2_.addChild(_healthBar.loader);
|
||||
}
|
||||
else
|
||||
{
|
||||
_healthBar.loader.content.hpMax = _healthBar.loader.content.hp = _hitPoints;
|
||||
}
|
||||
if(param1 != null)
|
||||
{
|
||||
param1.target.removeEventListener("complete",enemyLoadComplete);
|
||||
}
|
||||
_loadComplete = true;
|
||||
_pathIndex = -1;
|
||||
rotate();
|
||||
}
|
||||
|
||||
public function healthBarLoadComplete(param1:Event) : void
|
||||
{
|
||||
param1.target.loader.content.hpMax = param1.target.loader.content.hp = _hitPoints;
|
||||
param1.target.removeEventListener("complete",healthBarLoadComplete);
|
||||
}
|
||||
|
||||
public function isValidTarget() : Boolean
|
||||
{
|
||||
return !_waitingForRecycle;
|
||||
}
|
||||
|
||||
public function heartbeat(param1:Number) : void
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc2_:int = 0;
|
||||
if(_waitingForRecycle)
|
||||
{
|
||||
if(!_clone.loader.content.hasOwnProperty("dead") || _clone.loader.content.dead)
|
||||
{
|
||||
_waitingForRecycle = false;
|
||||
_clone.loader.parent.removeChild(_clone.loader);
|
||||
removeEnemy();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc3_ = 5;
|
||||
param1 /= _loc3_;
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < _loc3_)
|
||||
{
|
||||
updateEnemy(param1);
|
||||
_loc2_++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function updateEnemy(param1:Number) : void
|
||||
{
|
||||
var _loc3_:Number = NaN;
|
||||
var _loc2_:Number = NaN;
|
||||
switch(_state)
|
||||
{
|
||||
case 0:
|
||||
_loc3_ = Number(_clone.loader.x);
|
||||
_loc2_ = Number(_clone.loader.y);
|
||||
_clone.loader.x += _moveDirection.x * _speed * param1;
|
||||
_clone.loader.y += _moveDirection.y * _speed * param1;
|
||||
_distanceTraveled += Math.abs(_loc3_ - _clone.loader.x) + Math.abs(_loc2_ - _clone.loader.y);
|
||||
if(_pathIndex < _path.length)
|
||||
{
|
||||
if(_clone.loader.x != _loc3_ && Math.abs(_clone.loader.x - _currentTilePos.x) > Math.abs(_loc3_ - _currentTilePos.x) || _clone.loader.y != _loc2_ && Math.abs(_clone.loader.y - _currentTilePos.y) > Math.abs(_loc2_ - _currentTilePos.y))
|
||||
{
|
||||
_clone.loader.x = _currentTilePos.x;
|
||||
_clone.loader.y = _currentTilePos.y;
|
||||
_state = 1;
|
||||
rotate();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
rotate();
|
||||
}
|
||||
}
|
||||
|
||||
public function applyDamage(param1:int, param2:Boolean) : void
|
||||
{
|
||||
if(_hitPoints > 0)
|
||||
{
|
||||
_hitPoints -= param1;
|
||||
if(_hitPoints > 0)
|
||||
{
|
||||
_healthBar.loader.content.hp = _hitPoints;
|
||||
if(_clone.loader.content.hasOwnProperty("hit"))
|
||||
{
|
||||
_clone.loader.content.hit(false,param2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_theGame.enemyKilled(_type,_pathIndex / _path.length);
|
||||
if(_clone.loader.content.hasOwnProperty("hit"))
|
||||
{
|
||||
_clone.loader.content.hit(true,param2);
|
||||
}
|
||||
_waitingForRecycle = true;
|
||||
_theGame.play(_theGame["_soundNameEnemyKill" + (Math.floor(Math.random() * 4) + 1)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function removeEnemy() : void
|
||||
{
|
||||
_theGame._enemies.splice(_theGame._enemies.indexOf(this),1);
|
||||
_theGame._enemyPool.push(this);
|
||||
}
|
||||
|
||||
private function setCurrentTilePos() : void
|
||||
{
|
||||
_currentTilePos.x = _path[_pathIndex] % 14 * 50;
|
||||
_currentTilePos.y = Math.floor(_path[_pathIndex] / 14) * 50;
|
||||
}
|
||||
|
||||
private function rotate() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
_pathIndex = _pathIndex + 1;
|
||||
if(_pathIndex < _path.length)
|
||||
{
|
||||
setCurrentTilePos();
|
||||
if(_pathIndex > 0)
|
||||
{
|
||||
_loc1_ = _path[_pathIndex] - _path[_pathIndex - 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc1_ = _path[0] - _clone.loader.y / 50 * 14 - _clone.loader.x / 50;
|
||||
}
|
||||
switch(_loc1_)
|
||||
{
|
||||
case 1:
|
||||
_moveDirection.x = 1;
|
||||
_moveDirection.y = 0;
|
||||
if(_loadComplete && _clone.loader.content.hasOwnProperty("walk"))
|
||||
{
|
||||
_clone.loader.content.walk(2);
|
||||
}
|
||||
break;
|
||||
case -1:
|
||||
_moveDirection.x = -1;
|
||||
_moveDirection.y = 0;
|
||||
if(_loadComplete && _clone.loader.content.hasOwnProperty("walk"))
|
||||
{
|
||||
_clone.loader.content.walk(1);
|
||||
}
|
||||
break;
|
||||
case 14:
|
||||
_moveDirection.x = 0;
|
||||
_moveDirection.y = 1;
|
||||
if(_loadComplete && _clone.loader.content.hasOwnProperty("walk"))
|
||||
{
|
||||
_clone.loader.content.walk(3);
|
||||
}
|
||||
break;
|
||||
case -14:
|
||||
_moveDirection.x = 0;
|
||||
_moveDirection.y = -1;
|
||||
if(_loadComplete && _clone.loader.content.hasOwnProperty("walk"))
|
||||
{
|
||||
_clone.loader.content.walk(0);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new Error("Invalid path data");
|
||||
}
|
||||
}
|
||||
_state = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,322 @@
|
||||
package game.towerDefense
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.geom.Point;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class TowerDefenseTower
|
||||
{
|
||||
|
||||
public var _type:int;
|
||||
|
||||
public var _upgradeLevel:int;
|
||||
|
||||
public var _tileRow:int;
|
||||
|
||||
public var _tileColumn:int;
|
||||
|
||||
public var _clone:Object;
|
||||
|
||||
public var _theGame:TowerDefense;
|
||||
|
||||
public var _currentAttackTarget:TowerDefenseEnemy;
|
||||
|
||||
public var _attackLine:MovieClip;
|
||||
|
||||
public var _attackLineActive:Boolean;
|
||||
|
||||
public var _attackTime:Number;
|
||||
|
||||
public var _waitTime:Number;
|
||||
|
||||
public function TowerDefenseTower(param1:TowerDefense, param2:int)
|
||||
{
|
||||
super();
|
||||
_theGame = param1;
|
||||
_clone = {};
|
||||
_upgradeLevel = 0;
|
||||
_type = param2;
|
||||
_attackLine = new MovieClip();
|
||||
_attackLineActive = false;
|
||||
_attackTime = 0;
|
||||
_waitTime = 0;
|
||||
}
|
||||
|
||||
public function heartbeat(param1:Number) : void
|
||||
{
|
||||
update(param1);
|
||||
}
|
||||
|
||||
public function update(param1:Number) : void
|
||||
{
|
||||
if(_attackTime > 0)
|
||||
{
|
||||
_attackTime -= param1;
|
||||
if(_attackTime <= 0)
|
||||
{
|
||||
if(_attackLineActive)
|
||||
{
|
||||
_clone.loader.content.removeChild(_attackLine);
|
||||
_attackLineActive = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
findEnemy();
|
||||
attack();
|
||||
}
|
||||
}
|
||||
else if(_waitTime > 0)
|
||||
{
|
||||
_waitTime -= param1;
|
||||
}
|
||||
else
|
||||
{
|
||||
findEnemy();
|
||||
attack();
|
||||
}
|
||||
}
|
||||
|
||||
public function attack() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
var _loc2_:Point = null;
|
||||
if(_currentAttackTarget && _currentAttackTarget._clone.loader.content && _currentAttackTarget._healthBar.loader.content)
|
||||
{
|
||||
if(_attackTime <= 0)
|
||||
{
|
||||
_clone.loader.content.addChild(_attackLine);
|
||||
_attackLineActive = true;
|
||||
_attackTime += 0.05;
|
||||
_waitTime += _theGame._attackRate[_type][_upgradeLevel];
|
||||
if(_upgradeLevel == 0)
|
||||
{
|
||||
_loc1_ = int(_theGame._attackDamageModifier[_type][_currentAttackTarget._type]);
|
||||
}
|
||||
else if(_upgradeLevel == 1)
|
||||
{
|
||||
_loc1_ = int(_theGame._attackDamageModifier2[_type][_currentAttackTarget._type]);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc1_ = int(_theGame._attackDamageModifier3[_type][_currentAttackTarget._type]);
|
||||
}
|
||||
_currentAttackTarget.applyDamage(_theGame._attackDamage[_type][_upgradeLevel] + _loc1_,_theGame._attackPriority[_type].indexOf(_currentAttackTarget._type) != -1);
|
||||
}
|
||||
_attackTime -= 0.05;
|
||||
_attackLineActive = false;
|
||||
_loc2_ = getAttackSquare();
|
||||
if(_loc2_.x != 0 || _loc2_.y != 0)
|
||||
{
|
||||
_clone.loader.content.attack(_loc2_.x,_loc2_.y);
|
||||
_theGame.attack(_type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function getAttackSquare() : Point
|
||||
{
|
||||
var _loc1_:Point = new Point();
|
||||
var _loc3_:Object = _currentAttackTarget._clone.loader;
|
||||
var _loc2_:Object = _clone.loader;
|
||||
if(_loc3_.x < _loc2_.x - _loc2_.width / 2 - _loc2_.width)
|
||||
{
|
||||
_loc1_.x = -2;
|
||||
}
|
||||
else if(_loc3_.x < _loc2_.x - _loc2_.width / 2)
|
||||
{
|
||||
_loc1_.x = -1;
|
||||
}
|
||||
else if(_loc3_.x > _loc2_.x + _loc2_.width / 2 + _loc2_.width)
|
||||
{
|
||||
_loc1_.x = 2;
|
||||
}
|
||||
else if(_loc3_.x > _loc2_.x + _loc2_.width / 2)
|
||||
{
|
||||
_loc1_.x = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc1_.x = 0;
|
||||
}
|
||||
if(_loc3_.y < _loc2_.y - _loc2_.height / 2 - _loc2_.height)
|
||||
{
|
||||
_loc1_.y = -2;
|
||||
}
|
||||
else if(_loc3_.y < _loc2_.y - _loc2_.height / 2)
|
||||
{
|
||||
_loc1_.y = -1;
|
||||
}
|
||||
else if(_loc3_.y > _loc2_.y + _loc2_.height / 2 + _loc2_.height)
|
||||
{
|
||||
_loc1_.y = 2;
|
||||
}
|
||||
else if(_loc3_.y > _loc2_.y + _loc2_.height / 2)
|
||||
{
|
||||
_loc1_.y = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc1_.y = 0;
|
||||
}
|
||||
return _loc1_;
|
||||
}
|
||||
|
||||
public function findEnemy() : void
|
||||
{
|
||||
var _loc5_:int = 0;
|
||||
var _loc2_:Array = null;
|
||||
var _loc1_:int = 0;
|
||||
var _loc3_:Boolean = false;
|
||||
var _loc6_:Array = _theGame._enemies;
|
||||
var _loc9_:TowerDefenseEnemy = null;
|
||||
var _loc8_:Array = [];
|
||||
var _loc4_:Number = _theGame._attackRange[_type] * 50 + 24;
|
||||
for each(var _loc7_:TowerDefenseEnemy in _loc6_)
|
||||
{
|
||||
if(_loc7_.isValidTarget() && Math.abs(_loc7_._clone.loader.x - _clone.loader.x) <= _loc4_ && Math.abs(_loc7_._clone.loader.y - _clone.loader.y) <= _loc4_)
|
||||
{
|
||||
_loc8_.push(_loc7_);
|
||||
}
|
||||
}
|
||||
if(_loc8_.length > 0)
|
||||
{
|
||||
_loc8_.sortOn("_distanceTraveled",2 | 0x10);
|
||||
_loc9_ = _loc8_[0];
|
||||
_loc2_ = _theGame._attackPriority[_type];
|
||||
_loc1_ = -1;
|
||||
_loc3_ = false;
|
||||
for each(_loc7_ in _loc8_)
|
||||
{
|
||||
_loc5_ = 0;
|
||||
while(_loc5_ < _loc2_.length)
|
||||
{
|
||||
if(_loc7_._type == _loc2_[_loc5_])
|
||||
{
|
||||
_loc9_ = _loc7_;
|
||||
_loc3_ = true;
|
||||
break;
|
||||
}
|
||||
_loc5_++;
|
||||
}
|
||||
if(_loc3_)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
_currentAttackTarget = _loc9_;
|
||||
if(_currentAttackTarget == null && _attackLineActive == true)
|
||||
{
|
||||
_clone.loader.content.removeChild(_attackLine);
|
||||
_attackLineActive = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function enableMouse() : void
|
||||
{
|
||||
_clone.loader.content.addEventListener("mouseUp",showTowerOptions);
|
||||
}
|
||||
|
||||
public function showTowerOptions(param1:MouseEvent) : void
|
||||
{
|
||||
var _loc2_:Object = _theGame.getScene().getLayer("towerOptions").loader;
|
||||
_theGame._layerTowers.addChild(_loc2_ as DisplayObject);
|
||||
if(_theGame._mode == 0 || _theGame._mode == 1 || _upgradeLevel == 1 && _theGame._endless == false)
|
||||
{
|
||||
_theGame.getScene().getLayer("towerOptions").loader.content.upgradeButton.gotoAndStop("locked");
|
||||
}
|
||||
else if(_upgradeLevel + 1 >= _theGame._towerCost[_type].length)
|
||||
{
|
||||
_theGame.getScene().getLayer("towerOptions").loader.content.upgradeButton.gotoAndStop("max");
|
||||
}
|
||||
else if(_theGame._tokens < _theGame.getUpgradeCost(_type,_upgradeLevel))
|
||||
{
|
||||
_theGame.getScene().getLayer("towerOptions").loader.content.upgradeButton.gotoAndStop("short");
|
||||
}
|
||||
else
|
||||
{
|
||||
_theGame.getScene().getLayer("towerOptions").loader.content.upgradeButton.gotoAndStop("off");
|
||||
}
|
||||
if(_upgradeLevel == 0)
|
||||
{
|
||||
_theGame.getScene().getLayer("towerOptions").loader.content.upgradeButton.level1.visible = true;
|
||||
_theGame.getScene().getLayer("towerOptions").loader.content.upgradeButton.level2.visible = false;
|
||||
}
|
||||
else if(_upgradeLevel == 1)
|
||||
{
|
||||
_theGame.getScene().getLayer("towerOptions").loader.content.upgradeButton.level1.visible = false;
|
||||
_theGame.getScene().getLayer("towerOptions").loader.content.upgradeButton.level2.visible = true;
|
||||
}
|
||||
if(_theGame._activeDialogTower)
|
||||
{
|
||||
_theGame._activeDialogTower.towerOptionsClose(null);
|
||||
}
|
||||
_loc2_.x = _clone.loader.x;
|
||||
_loc2_.y = _clone.loader.y;
|
||||
_clone.loader.content.removeEventListener("mouseUp",showTowerOptions);
|
||||
_theGame.stage.addEventListener("mouseDown",towerOptionsClose);
|
||||
_loc2_.content.addEventListener("mouseOut",towerOptionsDetectOutsideClick);
|
||||
_loc2_.content.addEventListener("mouseOver",towerOptionsDetectInsideClick);
|
||||
LocalizationManager.translateIdAndInsert(_loc2_.content.upgradeButton.upgradeText,11990,_theGame.getUpgradeCost(_type,_upgradeLevel));
|
||||
LocalizationManager.translateIdAndInsert(_loc2_.content.sellButton.sellText,11991,_theGame.getSellPrice(_type,_upgradeLevel));
|
||||
_theGame._activeDialogTower = this;
|
||||
_theGame.play(_theGame._soundNameTowerSelect);
|
||||
}
|
||||
|
||||
public function towerOptionsDetectInsideClick(param1:MouseEvent) : void
|
||||
{
|
||||
_theGame.stage.removeEventListener("mouseDown",towerOptionsClose);
|
||||
_theGame.getScene().getLayer("towerOptions").loader.content.addEventListener("mouseOut",towerOptionsDetectOutsideClick);
|
||||
}
|
||||
|
||||
public function towerOptionsDetectOutsideClick(param1:MouseEvent) : void
|
||||
{
|
||||
_theGame.stage.addEventListener("mouseDown",towerOptionsClose);
|
||||
_theGame.getScene().getLayer("towerOptions").loader.content.removeEventListener("mouseOut",towerOptionsDetectOutsideClick);
|
||||
}
|
||||
|
||||
public function towerOptionsClose(param1:MouseEvent) : void
|
||||
{
|
||||
var _loc2_:Object = _theGame.getScene().getLayer("towerOptions").loader;
|
||||
if(_loc2_.parent)
|
||||
{
|
||||
_loc2_.parent.removeChild(_loc2_);
|
||||
}
|
||||
_loc2_.content.removeEventListener("mouseOut",towerOptionsDetectOutsideClick);
|
||||
_loc2_.content.removeEventListener("mouseOver",towerOptionsDetectInsideClick);
|
||||
_theGame.stage.removeEventListener("mouseDown",towerOptionsClose);
|
||||
_theGame._activeDialogTower = null;
|
||||
_theGame.play(_theGame._soundNameTowerDeselect);
|
||||
enableMouse();
|
||||
}
|
||||
|
||||
public function upgrade() : void
|
||||
{
|
||||
towerOptionsClose(null);
|
||||
if(_upgradeLevel + 1 < _theGame._towerCost[0].length)
|
||||
{
|
||||
_theGame._tokens -= _theGame.getUpgradeCost(_type,_upgradeLevel);
|
||||
_theGame.getScene().getLayer("background").loader.content.gemsText.text = _theGame._tokens;
|
||||
_upgradeLevel = _upgradeLevel + 1;
|
||||
_clone.loader.content.upgrade();
|
||||
_theGame.play(_theGame._soundNameTowerUpgrade);
|
||||
}
|
||||
}
|
||||
|
||||
public function sell() : void
|
||||
{
|
||||
towerOptionsClose(null);
|
||||
_clone.loader.parent.removeChild(_clone.loader);
|
||||
_theGame._tokens += _theGame.getSellPrice(_type,_upgradeLevel);
|
||||
_theGame.getScene().getLayer("background").loader.content.gemsText.text = _theGame._tokens;
|
||||
_theGame._placedTowers.splice(_theGame._placedTowers.indexOf(this),1);
|
||||
var _loc1_:int = _clone.loader.y / 50 * 14 + _clone.loader.x / 50;
|
||||
_theGame._towerLocations.splice(_theGame._towerLocations.indexOf(_loc1_),1);
|
||||
_theGame.play(_theGame._soundNameTowerSell);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user