Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.nitrome.badicecream
- {
- import flash.display.MovieClip;
- public class TowerEnemy extends Enemy
- {
- public var okToMove:Boolean = false;
- public var moves:Number = 0;
- private var stomp:MovieClip = null;
- public function TowerEnemy()
- {
- super();
- }
- override public function create(param1:Number, param2:Number) : void
- {
- super.create(param1,param2);
- moveSpeed = 3;
- Controller.level.tileGrid.getTile(tileX,tileY).itemInside = this;
- }
- override public function update() : void
- {
- var _loc1_:MovieClip = null;
- if(frameAction == "Walk")
- {
- _loc1_ = MovieClip(getChildAt(0));
- if(_loc1_.currentFrame == 15)
- {
- this.okToMove = true;
- }
- if(_loc1_.currentFrame == 27)
- {
- this.doStomp();
- }
- if(_loc1_.currentFrame == 35)
- {
- this.nextMove();
- }
- }
- this.movement();
- this.frameControl();
- }
- override public function movement() : void
- {
- if(!this.okToMove)
- {
- return;
- }
- super.movement();
- }
- override public function randomWalkUpdate() : void
- {
- super.randomWalkUpdate();
- }
- override protected function stepped() : void
- {
- super.stepped();
- }
- public function nextMove() : void
- {
- this.moves++;
- }
- override public function frameControl() : void
- {
- }
- public function teleport() : void
- {
- var _loc2_:Tile = null;
- var _loc3_:Tile = null;
- var _loc1_:Array = [];
- for each(_loc2_ in Controller.level.tileGrid.list)
- {
- if(!_loc2_.wall)
- {
- if(!(_loc2_.itemInside || _loc2_.collectibleInside))
- {
- _loc1_.push(_loc2_);
- }
- }
- }
- getTileUnderneath().itemInside = null;
- _loc3_ = _loc1_[Math.floor(_loc1_.length * Math.random())];
- tileX = _loc3_.gridX;
- tileY = _loc3_.gridY;
- x = (tileX + 0.5) * Controller.TILE_SIZE;
- y = tileY * Controller.TILE_SIZE;
- _loc3_.itemInside = this;
- frameAction = "TeleportIn";
- }
- public function finishTeleportAnimation() : void
- {
- frameAction = "Walk";
- this.moves = 0;
- }
- public function doStomp() : void
- {
- this.stomp = new Stomp();
- this.stomp.x = x;
- this.stomp.y = y + 18;
- }
- override public function render() : void
- {
- renderExtra(this.stomp);
- super.render();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement