"use strict";
/* what structural bosses build barriers with */

var GO_Forceblock = function(dx,dy){
	this.sprite = new Sprite(GO_Forceblock.spriteSheet,"Forceblock");
	this.sprite.collision_flags = 
		DEFINE_SPRITE_COLLISION_FLAGS.SPRITES_PASSIVE;
	this.sprite.setBoundingBox(
		0,
		0,
		15,
		15);
	//sprite.constraints=constraints;
	this.sprite.max_step = 0;
	this.sprite.game_object = this; // no longer a generic GO

	// a secondary sprite forming the solid core of the block
	this.core = new Sprite(null,"Forceblock_core");
	this.core.collision_flags = 
		DEFINE_SPRITE_COLLISION_FLAGS.SPRITES_PASSIVE |
		DEFINE_SPRITE_COLLISION_FLAGS.SOLID;
	this.core.setBoundingBox(3,3,12,12);
	this.core.game_object = this;

	this.countdown = 0;

};
GO_Forceblock.spriteImg = SDS_Load_Image("art/sheets/sprite/forceblock.png");
GO_Forceblock.spriteSheet = new TileSheet(4, 4, 2, 0, GO_Forceblock.spriteImg);

GO_Forceblock.prototype = new GameObject(
	new Sprite(
		GO_Forceblock.spriteSheet,
		"Forceblock"
	),
	"Forceblock"
	);

	GO_Forceblock.prototype.interactions = 
		DEFINE_GAMEOBJECT_INTERACTIONS.INFLICT;

	GO_Forceblock.prototype.addToRoom = function(mapRoom){
		mapRoom.addSprite(this.sprite);
		this.core.x = this.sprite.x;
		this.core.y = this.sprite.y;
		mapRoom.addSprite(this.core);
	}
	GO_Forceblock.prototype.clearFromRoom = function(mapRoom){
		mapRoom.removeSprite(this.sprite);
		mapRoom.removeSprite(this.core);
	}

	GO_Forceblock.prototype.inflict = function(){
		return {hp: 1, chi:8};
	};

	GO_Forceblock.prototype.Update = function(){
		++this.sprite.frame;
		this.sprite.frame = this.sprite.frame & 3;
	};

