melonJS
    Preparing search index...

    Function previous

    • load the previous level, and return a promise that settles once the level is in the world.

      With no level to go to this reports false WITHOUT loading anything, and the promise form resolves false rather than rejecting: running out of levels is an ordinary outcome, not an error.

      Parameters

      Returns Promise<boolean>

      resolves true, or false if there is no previous level

      await me.level.previous({ async: true });
      
    • load the previous level.

      With no level to go to this reports false WITHOUT loading anything, and the promise form resolves false rather than rejecting: running out of levels is an ordinary outcome, not an error.

      While the game loop is running the load is deferred to a timer, so this returns before anything is in the world — see level.load.

      Parameters

      • Optionaloptions: LevelLoadOptions & { async?: false }

        additional optional parameters

      Returns boolean

      true if the previous level was loaded, false if there is none