How to use the level/cells.js.Door function in level

To help you get started, we’ve selected a few level examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ondras / sleeping-beauty / src / js / being / pc.js View on Github external
_move(xy) {
		let entity = this._level.getEntity(xy);

		if (entity.blocks >= BLOCKS_MOVEMENT) {
			log.add("You bump into %a.", entity);
			if (entity instanceof cells.Door && !TUTORIAL.door) {
				TUTORIAL.door = true;
				log.add("To interact with stuff, press both a {#fff}modifier key{} (Ctrl, Alt, Shift or Command) and a {#fff}direction key{} (used for movement).");
			}
			if (entity instanceof Being && !TUTORIAL.enemy) {
				log.add("If you wish to interact with beings (attack them, for example), press both a {#fff}modifier key{} (Ctrl, Alt, Shift or Command) and a {#fff}direction key{} (used for movement).");
				TUTORIAL.enemy = true;
			}
			return;
		}

		this.moveTo(xy);
		this._resolve(); // successful movement
	}