"use strict";

// =^.^=
var GO_Kitty = function(){
	this.sprite = new Sprite(GO_Kitty.spriteSheet,"Kitty");
	this.sprite.collision_flags = 
		DEFINE_SPRITE_COLLISION_FLAGS.SPRITES_PASSIVE;
	this.sprite.setBoundingBox(0,2,15,15);
	this.sprite.game_object = this; // no longer a generic GO

	this.name = "Kitty";

	this.petted = false;

	this.direction = 1;
};
GO_Kitty.spriteImg = SDS_Load_Image("art/sheets/sprite/kitty.png");
GO_Kitty.spriteSheet = new TileSheet(4, 4, 2, 0, GO_Kitty.spriteImg);

GO_Kitty.prototype = new GameObject(
	new Sprite(
		GO_Kitty.spriteSheet,
		"Kitty"
	),
	"Kitty"
	);

	GO_Kitty.prototype.interactions = DEFINE_GAMEOBJECT_INTERACTIONS.CHECK;

	GO_Kitty.prototype.Update = function(){
		this.sprite.frame = this.petted ? 1 : 0;
		this.sprite.frame += (this.direction<0) ? 2 : 0;
	};

	GO_Kitty.prototype.checkEvent = function(sourceGO){
		if (sourceGO && sourceGO.sprite) this.direction = (sourceGO.sprite.x<this.sprite.x) ? -1 : 1;

		this._heap.petted = this.petted;
		this.petted = true;

		// filed under ULTIMATE CLIMACTIC BATTLE TO THE DEATH BETWEEN RIVAL GOD-ENTITIES ... that is, grey.
		if (GLOBAL_DIARY.check(0,"GREY_4")) return "GD_Kitty";
		else{
			if (this._heap.petted) return "GD_grey_hint_heard";
			else if (!GLOBAL_DIARY.check(0,"GREY_LOC_VILLAGE")) return "GD_grey_village_hint";
			else if (!GLOBAL_DIARY.check(0,"GREY_LOC_BAYSHRINE")) return "GD_grey_bayshrine_hint";
			else if (!GLOBAL_DIARY.check(0,"GREY_LOC_FOREST")) return "GD_grey_forest_hint";
			else if (!GLOBAL_DIARY.check(0,"GREY_LOC_SKY")) return "GD_grey_sky_hint";
			return "GD_Kitty"; // should not get here, but jic
		}
	};
