/*
* A line of spikes; for map object consolidation
*/
"use strict";

var GO_SpikeLine = function(count,dx,dy){
	//this.sprite = new Sprite(null,"SpikeLine");
	//this.sprite.collision_flags = 0;
	//this.sprite.setBoundingBox(2,2,12,12);
	////sprite.constraints=constraints;
	//this.sprite.max_step = 0;
	//this.sprite.game_object = this; // no longer a generic GO

	this.spikes = [];

	for (this._heap.i=0; this._heap.i<count; ++this._heap.i){
		this.spikes.push(new Sprite(GO_Spike.spriteSheet,"Spike"));
		this.spikes[this._heap.i].collision_flags = 
			DEFINE_SPRITE_COLLISION_FLAGS.SPRITES_PASSIVE;
		this.spikes[this._heap.i].setBoundingBox(2,2,12,12);
		this.spikes[this._heap.i].max_step = 0;
		this.spikes[this._heap.i].game_object = this; // no longer a generic GO
	}

	this.sprite = this.spikes[0]; // "need" to have one, so let's just reuse

	this.dx = dx;
	this.dy = dy;
};
//GO_Spike.spriteImg = SDS_Load_Image("art/sheets/sprite/spike.png");
//GO_Spike.spriteSheet = new TileSheet(4, 4, 0, 0, GO_Spike.spriteImg);

GO_SpikeLine.prototype = new GameObject(
	new Sprite(
		GO_Spike.spriteSheet,
		"SpikeLine"
	),
	"SpikeLine"
	);

	GO_SpikeLine.prototype.interactions = DEFINE_GAMEOBJECT_INTERACTIONS.INFLICT;

	GO_SpikeLine.prototype.inflict = function(){
		return GO_Spike.prototype.inflict();
	};

	GO_SpikeLine.prototype.addToRoom = function(mapRoom){
		//mapRoom.addSprite(this.sprite);

		for (this._heap.i=0; this._heap.i<this.spikes.length; ++this._heap.i){
			mapRoom.addSprite(this.spikes[this._heap.i]);
			this.spikes[this._heap.i].x = this.sprite.x + (this._heap.i*this.dx);
			this.spikes[this._heap.i].y = this.sprite.y + (this._heap.i*this.dy);
		}
	}

	GO_SpikeLine.prototype.Update = function(){

	};



