Re:Punti salvataggio nel gioco

#218406

Fabio Meloni
Partecipante
  • Blenderista
  • Conversazioni totali8
### Add objects to be saved to this list ###

cube = bge.logic.getCurrentScene().objects[“Cube”]

 

### Open the file “Game1.sav” in read mode

loadFile = open(“Game1.sav”, “r”)

### Check for the header

header = loadFile.readline()

header = header[0:-1]

 

if header == “This is a valid save file”:

       ### Load game data to file

       for x in range(len(cube.position)):

           loadCoord = loadFile.readline()

  cubePosi[x] = float(loadCoord[0:-1])

  cube.setPosition(cubePosi)

       for x in range(len(cube.orientation)):

           for y in range(len(cube.orientation[x])):

               loadCoord = loadFile.readline()

  cubeRot[x][y] = float(loadCoord[0:-1])

  cube.setOrientation(cubeRot)

 

### Close save file

loadFile.close()

 

 

mi dice che c’è un errore nella riga 14
0