"use strict";

// skyshrine traps firing golden arows
var GO_Boltslot = function(direction){
	direction = direction<0 ? -1 : 1;
	this.sprite = new Sprite(GO_Boltslot.spriteSheet,"Boltslot");
	this.sprite.collision_flags = 0;
	this.sprite.setBoundingBox(0,1,15,6);
	//sprite.constraints=constraints;
	this.sprite.max_step = 0;
	this.sprite.game_object = this; // no longer a generic GO

	this.sprite.frame = (direction<0) ? 1 : 0;

	this.direction = direction;

};
GO_Boltslot.spriteImg = SDS_Load_Image("art/sheets/sprite/boltslot.png");
GO_Boltslot.spriteSheet = new TileSheet(4, 3, 0, 1, GO_Boltslot.spriteImg);

GO_Boltslot.prototype = new GameObject(
	new Sprite(
		GO_Boltslot.spriteSheet,
		"Boltslot"
	),
	"Boltslot"
	);

	GO_Boltslot.prototype.interactions = 
		DEFINE_GAMEOBJECT_INTERACTIONS.SIGNALABLE;

	GO_Boltslot.prototype.signal = function(sourceGO,direction){
		if (direction>0){
			this._heap.bolt = new GO_Goldbolt(this.direction);
			this._heap.bolt.sprite.x = (this.direction>0) ?
				this.sprite.x+5 :
				this.sprite.x-5;
			this._heap.bolt.sprite.y = this.sprite.y;

			this.sprite.map_room.addSprite(this._heap.bolt.sprite);
			this.manager.add(this._heap.bolt);

			this._heap.bolt = null;

			this.sfx = new Chiptune("FX_boltshot",SDS.sfxchip);
			this.sfx.play(false);
		}
	};

	GO_Boltslot.prototype.Update = function(){
		
	};

