home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mobiclic 145
/
MOBICLIC145.ISO
/
pc
/
DATA
/
DSS145
/
DSS145_12
/
DSS145_12.swf
/
scripts
/
dss145_12
/
Enemy.as
< prev
next >
Wrap
Text File
|
2012-07-19
|
3KB
|
106 lines
package dss145_12
{
import com.touchmypixel.games.utils.Animation;
import com.touchmypixel.games.utils.AnimationManager;
import flash.display.MovieClip;
public class Enemy
{
public var type:String;
public var DECOR:Decor;
public var _movie:MovieClip;
protected var _animationPerformerManager:AnimationManager = null;
public var anim:MovieClip;
public var xOriginal:Number = 0;
public var yOriginal:Number = 0;
public var x:Number = 0;
public var y:Number = 0;
public var speed:Number = 4;
public var speedX:Number = 0;
public var speedY:Number = 0;
public var attackParams:Object;
public function Enemy(param1:Decor, param2:MovieClip)
{
super();
this.DECOR = param1;
this._movie = param2;
this.x = this.xOriginal = this._movie.x;
this.y = this.yOriginal = this._movie.y;
this.anim = this.getPerformedAnim(this._movie);
this.anim.gotoAndPlay(1);
}
public function set scaleX(param1:Number) : void
{
this.anim.scaleX = param1;
}
public function get scaleX() : Number
{
return this.anim.scaleX;
}
public function setPos(param1:Number, param2:Number) : void
{
this.x = param1;
this.y = param2;
}
public function move() : void
{
this.x += this.speedX;
this.y += this.speedY;
}
public function redraw() : void
{
this.anim.x = this.x;
this.anim.y = this.y;
}
protected function getPerformedAnim(param1:MovieClip) : MovieClip
{
if(this._animationPerformerManager == null)
{
this._animationPerformerManager = new AnimationManager();
}
var _loc2_:Animation = this._animationPerformerManager.addAnimation(param1);
if(param1.parent != null)
{
_loc2_.x = param1.getRect(param1).x;
_loc2_.y = param1.getRect(param1).y;
param1.parent.addChildAt(_loc2_,param1.parent.getChildIndex(param1));
param1.visible = false;
}
_loc2_.gotoAndStop(1);
return _loc2_;
}
public function destroy() : void
{
if(this.anim is Animation)
{
(this.anim as Animation).destroy();
}
this.anim = null;
this._movie = null;
this.DECOR = null;
}
}
}