package com.ezardlabs.lostsector.objects.environment;

import com.ezardlabs.dethsquare.Script;
import com.ezardlabs.lostsector.objects.Player;

public class Door extends Script {

	@Override
	public void start() {
	}

	@Override
	public void update() {
		if (Player.player.collider.bounds.bottom > gameObject.collider.bounds.top &&
				Player.player.collider.bounds.top < gameObject.collider.bounds.bottom &&
				Math.abs(transform.position.x + 100 - Player.player.transform.position.x) < 600) {
			gameObject.animator.play("open");
			gameObject.setTag(null);
		} else {
			gameObject.animator.play("close");
			gameObject.setTag("solid");
		}
	}
}

package com.ezardlabs.lostsector.objects.environment;

import com.ezardlabs.dethsquare.Collider;
import com.ezardlabs.dethsquare.GameObject;
import com.ezardlabs.dethsquare.Script;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentHashMap.KeySetView;

public class Door extends Script {

	@Override
	public void start() {
		GameObject.instantiate(new GameObject("DoorDetection", new Collider(1200, 500, true),
				new DoorDetection(this)), transform.position.offset(-500, 0));
	}

	private void open() {
		gameObject.animator.play("open");
		gameObject.setTag(null);
	}

	private void close() {
		gameObject.animator.play("close");
		gameObject.setTag("solid");
	}

	private class DoorDetection extends Script {
		private final Door door;
		private KeySetView<Collider, Boolean> colliders = ConcurrentHashMap.newKeySet();

		private DoorDetection(Door door) {
			this.door = door;
		}

		@Override
		public void update() {
			colliders.stream()
					 .filter(collider -> !gameObject.collider.bounds.contains(collider.bounds) &&
							 !gameObject.collider.bounds.intersects(collider.bounds))
					 .forEach(collider -> colliders.remove(collider));
			if (colliders.size() > 0) {
				door.open();
			} else {
				door.close();
			}
		}

		@Override
		public void onTriggerEnter(Collider other) {
			if (other.gameObject.getTag().equals("player") ||
					other.gameObject.getTag().equals("enemy")) {
				colliders.add(other);
			}
		}
	}
}

Change door open/close detection to use trigger colliders