Game Logic: startGame

startGame(blendFile)
  • Starts the game by loading the blend file from your hard drive.

blendFile:

  • Name of the blend file (and blend file path) to be loaded.
  • Type: string
Notes:
  • "//" = the directory of the blend that is currently running
  • Use / as directory separator in path.
  • You can include subdirectories in the path by using ("//" + "subdir_name\\")
Sample Code

################## start the game with this blend file
  

# import bge
import bge

# start the game with this blend file
# Level_1.blend is in same directory as running blend file
bge.logic.startGame("Level_1.blend")

Sample Code

################## start the game with this blend file
  

# import bge
import bge

# start the game with this blend file
# Level_1.blend in sub directory named Levels
bge.logic.startGame("//" + "Levels\\" + "Level_1.blend")