"use strict";

var GO_GoldenTrident = function(diaryname){
	this.sprite = new Sprite(GO_GoldenTrident.spriteSheet,"GoldenTrident");
	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

	//if (!GLOBAL_DIARY.check(1,"TRIDENT")){
	//	this.interactions|=DEFINE_GAMEOBJECT_INTERACTIONS.COLLECT;
	//}
		
	this.frame_timer=2;
};
GO_GoldenTrident.spriteImg = SDS_Load_Image("art/sheets/sprite/trident.png");
GO_GoldenTrident.spriteSheet = new TileSheet(4, 4, 3, 0, GO_GoldenTrident.spriteImg);

GO_GoldenTrident.prototype = new GameObject(
	new Sprite(
		GO_GoldenTrident.spriteSheet,
		"GoldenTrident"
	),
	"GoldenTrident"
	);

	GO_GoldenTrident.prototype.interactions = 
		DEFINE_GAMEOBJECT_INTERACTIONS.CHECK;

	GO_GoldenTrident.prototype.checkEvent = function(sourceGO){
		if (!GLOBAL_DIARY.check(1,"TRIDENT")){
			this.sprite.map_room.removeSprite(this.sprite);
			this.manager.remove(this);
			GLOBAL_DIARY.note(1,"TRIDENT");
			return "GD_Get_GoldTrident";
		}
		return "GD_Leave_GoldTrident";
	}

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

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

