/*
* A line of skewers; for map object consolidation
*/
"use strict";
// orientation:
// 0: top-facing
// 1: right-facing
// 2: down-facing
// 3: left-facing
var GO_SkewerLine = function(orientation,idx,count,pitch){
	idx = idx ? idx%4 : 0;
	this.dx = this.dy = 0;
	pitch = pitch ? pitch : 4;

	switch(orientation){
		case 3:
			this.dy = pitch;
		break;
		case 2:
			this.dx = pitch;
		break;
		case 1:
			this.dy = pitch;
		break;
		default:
			this.dx = pitch;
		break;
	}

	this.spikes = [];

	for (this._heap.i=0; this._heap.i<count; ++this._heap.i){
		this.spikes.push(new GO_Skewer(orientation,idx).sprite); // let the Skewer constructor do the work (sorry, GC)
		this.spikes[this._heap.i].game_object = this; // no longer a generic GO
		idx = (idx+1)&3;
	}

	this.sprite = this.spikes[0]; // "need" to have one, so let's just reuse
};
//GO_Skewer.spriteImg = SDS_Load_Image("art/sheets/sprite/dark_spikes.png");
//GO_Skewer.spriteSheetH = new TileSheet(3, 4, 3, 1, GO_Skewer.spriteImg);
//GO_Skewer.spriteSheetV = new TileSheet(4, 3, 2, 2, GO_Skewer.spriteImg);

GO_SkewerLine.prototype = new GameObject(
	new Sprite(
		GO_Skewer.spriteSheet,
		"SkewerLine"
	),
	"SkewerLine"
	);

	GO_SkewerLine.prototype.interactions = DEFINE_GAMEOBJECT_INTERACTIONS.INFLICT;

	GO_SkewerLine.prototype.inflict = function(){
		return GO_Skewer.prototype.inflict();
	};

	GO_SkewerLine.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_SkewerLine.prototype.Update = function(){

	};



