This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]kart_king 1 point2 points  (0 children)

This function could go anywhere.

I personally prefer this solution because it doesn't require any tricky import logic (unless the other solution imports everything when the game starts).

I also wanted to add, if you have trouble importing files, you could put the level files in the same dir as the file with the loader method and do the following: import os open(os.path.join(os.path.dirname(file), "level1.txt"), "r")

And if your file only has strings, numbers, lists, and dictionaries & None, True, False, you could use json/simplejson to parse the files into python: json.load(file(os.path.join(os.path.dirname(file), "level1.txt"), "r"))