# Best way to switch to new level

**URL:** <https://phaser.discourse.group/t/best-way-to-switch-to-new-level/1346>\
**Category:** Phaser 3\
**Created:** [February 22, 2019, 10:59am UTC](https://phaser.discourse.group/t/best-way-to-switch-to-new-level/1346 "2019-02-22T10:59:50Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![yannick](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/yannick/32/732_2.png) [@yannick](https://phaser.discourse.group/u/yannick)\
**Post date:** [February 22, 2019, 11:13am UTC](https://phaser.discourse.group/t/best-way-to-switch-to-new-level/1346/2 "2019-02-22T11:13:25Z")

</div>

This is how I do it and always did:  
(_Restarting the whole scene every time_)

```javascript
export default class MainScene extends Phaser.Scene {
  currentLevel

  constructor() {
    super({ key: 'MainScene' })
  }

  init(props) {
    const { level = 0 } = props
    this.currentLevel = level
  }

  preload() {
    // load the correct map based on this.currentLevel
  }

  create() {
    console.log(this.currentLevel)

    // start the next level after 2.5 seconds
    this.time.addEvent({
      delay: 2500,
      callback: () => this.scene.restart({ level: this.currentLevel + 1 })
    })
  }
}

```

Maybe my [Phaser 3: Platformer Example](https://github.com/yandeu/phaser3-typescript-platformer-example) will help you too!

---

_[View the full topic](https://phaser.discourse.group/t/best-way-to-switch-to-new-level/1346)._
