"use strict";

var GO_SkyDoor = function(unlocked,getDestName,relocate){
	this.sprite = new Sprite(GO_SkyDoor.spriteSheet,"SkyDoor");
	
	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.unlocked=unlocked;
	if (this.unlocked) this.interactions=DEFINE_GAMEOBJECT_INTERACTIONS.PORT;
	this._getDestName = getDestName;
	this.relocate = relocate;
};
GO_SkyDoor.spriteImg = SDS_Load_Image("art/sheets/sprite/skydoor.png");
GO_SkyDoor.spriteSheet = new TileSheet(4, 4, 1, 0, GO_SkyDoor.spriteImg);

GO_SkyDoor.prototype = new GameObject(
	new Sprite(
		GO_SkyDoor.spriteSheet,
		"SkyDoor"
	),
	"SkyDoor"
	);

	GO_SkyDoor.prototype.interactions = 
		//DEFINE_GAMEOBJECT_INTERACTIONS.PORT;
		DEFINE_GAMEOBJECT_INTERACTIONS.CHECK;

	GO_SkyDoor.prototype.checkEvent = function(){
		if (GLOBAL_DIARY.check(4,"HAS_KEYS")){
			this.interactions=DEFINE_GAMEOBJECT_INTERACTIONS.PORT;
			this.unlocked=true;
			return "GD_Sky_door_unlocked";
		}
		else{
			return "GD_Sky_door_locked";
		}
		//return this.unlocked ? this._getDestName() : null;
	};

	GO_SkyDoor.prototype.getDestName = function(){
		return this.unlocked ? this._getDestName() : null;
	};

	GO_SkyDoor.prototype.Update = function(){
		this.sprite.frame = this.unlocked ? 0 : 1;
	};
