"use strict";

var GO_Poof = function(sound){
	this.sprite = new Sprite(GO_Poof.spriteSheet,"Poof");
	this.sprite.collision_flags = 0;
	this.sprite.setBoundingBox(0,0,15,15);
	//this.sprite.constraints=constraints;
	this.sprite.max_step = 0;
	this.sprite.game_object = this; // no longer a generic GO

	this.frame_timer = 0;

	// null is the no-argument implicit poof sfx
	// so need to pass "" fo an explicit "do not play"
	if (sound!==""){
		sound = sound ? sound : "FX_poof";
		this.sfx = new Chiptune(sound,SDS.sfxchip);
		this.sfx.play(false);
	}

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

GO_Poof.prototype = new GameObject(
	new Sprite(
		GO_Poof.spriteSheet,
		"Poof"
	),
	"Poof"
	);

	GO_Poof.prototype.interactions = 0;

	GO_Poof.prototype.Update = function(){
		this.frame_timer++;
		this.sprite.frame = this.frame_timer>>1;
		if (this.sprite.frame>3){
			this.sprite.map_room.removeSprite(this.sprite);
			this.manager.remove(this);
		}
	}