/*
Soul drops which increase the life total
*/

"use strict";

var GO_Soul = function(soulname){
	this.sprite = new Sprite(GO_Soul.spriteSheet,"Soul");
	this.sprite.collision_flags = 
		DEFINE_SPRITE_COLLISION_FLAGS.SPRITES_PASSIVE;
	this.sprite.setBoundingBox(2,2,13,13);
	this.sprite.game_object = this; // no longer a generic GO

	this.soulname = soulname;
		
	this.frame_timer=0;
}
GO_Soul.spriteImg = SDS_Load_Image("art/sheets/sprite/drops.png");
GO_Soul.spriteSheet = new TileSheet(4, 4, 2, 3, GO_Soul.spriteImg);

GO_Soul.prototype = new GameObject(
	new Sprite(
		GO_Soul.spriteSheet,
		"Soul"
	),
	"Soul"
	);

	GO_Soul.prototype.interactions = 
		DEFINE_GAMEOBJECT_INTERACTIONS.COLLECT;

	GO_Soul.prototype.collect = function(sourceGO){
		this.sprite.map_room.removeSprite(this.sprite);
		this.manager.remove(this);
		GLOBAL_DIARY.collectSoul(this.soulname);
		return "Get_Soul";
	};

	GO_Soul.prototype.Update = function(){
		this.frame_timer++;
		this.frame_timer&=15;
		this.sprite.frame = this.frame_timer>>2;
		
		this.sprite.frame+=16;
	};
	