/*
The first treasure
*/
"use strict";

var GO_Bracelets = function(){
	this.sprite = new Sprite(GO_Bracelets.spriteSheet,"Bracelets");
	this.sprite.collision_flags = 
		DEFINE_SPRITE_COLLISION_FLAGS.SPRITES_PASSIVE;
	this.sprite.setBoundingBox(0,0,15,15);
	this.sprite.game_object = this; // no longer a generic GO
		
	this.frame_timer=4;
};
GO_Bracelets.spriteImg = SDS_Load_Image("art/sheets/sprite/bracelets.png");
GO_Bracelets.spriteSheet = new TileSheet(4, 4, 3, 0, GO_Bracelets.spriteImg);

GO_Bracelets.prototype = new GameObject(
	new Sprite(
		GO_Bracelets.spriteSheet,
		"Bracelets"
	),
	"Bracelets"
	);

	GO_Bracelets.prototype.interactions = 
		DEFINE_GAMEOBJECT_INTERACTIONS.CHECK |
		DEFINE_GAMEOBJECT_INTERACTIONS.COLLECT;

	GO_Bracelets.prototype.checkEvent = function(sourceGO){
		this.sprite.map_room.removeSprite(this.sprite);
		this.manager.remove(this);
		GLOBAL_DIARY.note(1,"TREASURE");
		GLOBAL_DIARY.hasBracelets=true;
		return "Get_Bracelets";
	};

	GO_Bracelets.prototype.collect = function(sourceGO){
		return this.checkEvent(sourceGO);
	};

	GO_Bracelets.prototype.Update = function(){
		this.frame_timer--;
		if (this.frame_timer<=0){
			this.sprite.frame = (this.sprite.frame+1)%5;
			this.frame_timer=4;
		}
	};
