How to use the rot-js.Scheduler function in rot-js

To help you get started, we’ve selected a few rot-js 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 Larkenx / Rotten-Soup / src / assets / js / game / Game.js View on Github external
scheduleAllActors() {
		// Set up the ROT engine and scheduler
		this.scheduler = new ROT.Scheduler.Simple()
		// this.scheduler.add(new PlayerController(), true) // Add the player to the scheduler
		this.scheduler.add(this.player, true) // Add the player to the scheduler
		this.scheduler.add(this.display, true)
		let actors = this.map.getActors()
		for (let actor of actors) {
			if (actor.seenTiles) actor.seenTiles = []
			// Some 'actor' objects do not take turns, such as ladders / items
			if (actor !== this.player && actor instanceof Actor) {
				this.scheduler.add(actor, true)
				// if the actor is goal driven, clear their current goals
				if (actor.subscribeToEventStream) actor.clearGoals()
			}
		}
		// emit a new spawned event when each actor gets loaded in
		actors.forEach(actor => this.eventStream.emit('EntitySpawnedEvent', { entity: actor }))
		this.engine = new ROT.Engine(this.scheduler) // Create new engine with the newly created scheduler
github seiyria / Roguathia / src / js / rogue / init / game.js View on Github external
setup() {
    this.scheduler = new ROT.Scheduler.Speed();
    this.engine = new ROT.Engine(this.scheduler);
    
/*    if(false) {
      this.loadOldData();
      return;
    }
*/

    this.startNewGame();
  }
github seiyria / Roguathia / src / js / rogue / init / game.js View on Github external
setup() {
    this.scheduler = new ROT.Scheduler.Speed();
    this.engine = new ROT.Engine(this.scheduler);
    
/*    if(false) {
      this.loadOldData();
      return;
    }
*/

    this.startNewGame();
  }