/*
Tear drops which increase the chi total
*/

"use strict";

var GO_Tear = function(tearname){
	this.sprite = new Sprite(GO_Tear.spriteSheet,"Tear");
	this.sprite.collision_flags = 
		DEFINE_SPRITE_COLLISION_FLAGS.SPRITES_PASSIVE;
	this.sprite.setBoundingBox(4,2,10,13);
	this.sprite.game_object = this; // no longer a generic GO

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

GO_Tear.prototype = new GameObject(
	new Sprite(
		GO_Tear.spriteSheet,
		"Tear"
	),
	"Tear"
	);
	
	GO_Tear.prototype.interactions = 
		DEFINE_GAMEOBJECT_INTERACTIONS.COLLECT;
	
	GO_Tear.prototype.collect = function(sourceGO){
		this.sprite.map_room.removeSprite(this.sprite);
		this.manager.remove(this);
		GLOBAL_DIARY.collectTear(this.tearname);
		//return "GD_Get_Tear";
		return "Get_Tear";
	};

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