"use strict";
/* "killbox" might be more accurate.  invisible zone which collides with and damages enemies */
var GO_Killplane = function(w,h,dx,dy){
	this.sprite = new Sprite(null,"Killplane");
	this.sprite.collision_flags = DEFINE_SPRITE_COLLISION_FLAGS.SPRITES_ACTIVE;
	this.sprite.setBoundingBox(0,0,w,h);
	this.sprite.game_object = this; // no longer a generic GO

	// direction to step the killplane out & back to generate into-enemy collisions
	this.dx = dx;
	this.dy = dy;
};

GO_Killplane.prototype = new GameObject(
	new Sprite(
		null,
		"Killplane"
	),
	"Killplane"
	);

	GO_Killplane.prototype.interactions = 0;

	GO_Killplane.prototype.Update = function(){
		this.sprite.move(this.dx,this.dy,  this._heap.spriteMoveRes);
		this.sprite.move(-this.dx,-this.dy,  this._heap.spriteMoveRes);
		
		if (this._heap.spriteMoveRes.flags & DEFINE_SPRITE_MOVE_RESULT_FLAGS.COLLIDING_S){
			for (this._heap.i=0; this._heap.i<this._heap.spriteMoveRes.collisions.length; this._heap.i++){
				if (this._heap.spriteMoveRes.collisions[this._heap.i].game_object.interactions & DEFINE_GAMEOBJECT_INTERACTIONS.DAMAGE){
					this._heap.spriteMoveRes.collisions[this._heap.i].game_object.damage(this,1000);
				}
			}
		}
	}
