Scene: replace

replace(newScene)
  • Replace the current scene with a new scene.

newScene:

  • the name of the scene that replaces the current scene
  • Type:  string
Sample Code

################## replace the current scene with a new one
 

# import bge
import bge

# get current scene
scene = bge.logic.getCurrentScene()

# replace with new scene named LevelTwo
scene.replace("LevelTwo")