How to use the level/cells.js.Floor 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 / being.js View on Github external
die() {
		let level = this._level;
		let xy = this._xy;

		this.moveTo(null);
		actors.remove(this);
		
		let items = this.inventory.getItems();
		if (items.length > 0 && level.getEntity(xy) instanceof cells.Floor) {
			let item = items.random();
			this.inventory.removeItem(item);
			level.setItem(xy, item);
		}
	}