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

var GO_Circlet = function(){
	this.sprite = new Sprite(GO_Circlet.spriteSheet,"Circlet");
	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_Circlet.spriteImg = SDS_Load_Image("art/sheets/sprite/circlet.png");
GO_Circlet.spriteSheet = new TileSheet(4, 4, 3, 0, GO_Circlet.spriteImg);

GO_Circlet.prototype = new GameObject(
	new Sprite(
		GO_Circlet.spriteSheet,
		"Circlet"
	),
	"Circlet"
	);

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

	GO_Circlet.prototype.checkEvent = function(sourceGO){
		this.sprite.map_room.removeSprite(this.sprite);
		this.manager.remove(this);
		GLOBAL_DIARY.note(4,"TREASURE");
		GLOBAL_DIARY.hasCirclet=true;
		return "Get_Circlet";
	};

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

	GO_Circlet.prototype.Update = function(){
		this.frame_timer--;
		if (this.frame_timer<=0){
			this.sprite.frame = (this.sprite.frame+1)&7;
			this.frame_timer=6;
		}
	};
