Game Erstellen In UPBGE #19 Score als Textfile speichern und laden




###LevelData.py###
def save_score():
global score
path = bge.logic.expandPath(‘//’)

with open(path + ‘Endscore.txt’, ‘w’) as save:
save.write(str(score))

###Startscreen.py###
def display_endscore(cont):
own = cont.owner
path = bge.logic.expandPath(‘//’)

with open(path + ‘Endscore.txt’, ‘r’) as read:
endscore = read.read()
own[‘Text’] = endscore

Voir sur youtube

KA2Studio
Logo
Compare items
  • Total (0)
Compare
0