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

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

GO_Belt.prototype = new GameObject(
	new Sprite(
		GO_Belt.spriteSheet,
		"Belt"
	),
	"Belt"
	);

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

	GO_Belt.prototype.checkEvent = function(sourceGO){
		this.sprite.map_room.removeSprite(this.sprite);
		this.manager.remove(this);
		GLOBAL_DIARY.note(3,"TREASURE");
		GLOBAL_DIARY.hasBelt=true;
		return "Get_Belt";
	};

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

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