home *** CD-ROM | disk | FTP | other *** search
- class com.neodelight.v2D.MoverShot extends com.neodelight.v2D.Mover
- {
- var client;
- var actAge;
- var maxAge;
- var dieOffscreen;
- var screenPos;
- var origin;
- function MoverShot(client, config)
- {
- super(client);
- this.client.freeMovement = true;
- this.actAge = 0;
- this.maxAge = com.neodelight.std.XMath.toNumber(config.maxAge);
- this.dieOffscreen = Boolean(config.dieOffscreen);
- if(config.moverWeight)
- {
- this.client.weight = com.neodelight.std.XMath.toNumber(config.moverWeight);
- }
- this.client.v.x = com.neodelight.std.XMath.toNumber(config.moverVx);
- this.client.v.y = com.neodelight.std.XMath.toNumber(config.moverVy);
- }
- function move()
- {
- super.move();
- if(this.maxAge)
- {
- this.actAge += _global.dt;
- if(this.actAge >= this.maxAge)
- {
- this.client.die();
- }
- }
- if(this.dieOffscreen)
- {
- if(this.screenPos.x < 0 || this.screenPos.x > _global.game.stageWidth || this.screenPos.y < 0 || this.screenPos.y > _global.game.stageHeight)
- {
- this.client.kill();
- }
- }
- }
- function getTotalBoundingRect()
- {
- this.client.totalBoundingRect.p0.x = this.origin.x;
- this.client.totalBoundingRect.p0.y = this.origin.y;
- this.client.totalBoundingRect.p1.x = this.origin.x;
- this.client.totalBoundingRect.p1.y = this.origin.y;
- return this.client.totalBoundingRect;
- }
- }
-