I have a file called options.txt
:
fullscreen = False
screen_width = 1920
screen_height = 1080
walk_up = 119
walk_down = 115
walk_left = 97
walk_right = 100
inventory = 9
jump = 32
collect_item = 101
It contains some information that I want to be able to set variables to. For example, this line is creating a window, and I want to be able to set these arguments to the value from the options.txt
file. How can I do this?
(pseudo code):
settings = open("options.txt").read()
pg.display.set_mode((settings.screen_width, settings.screen_height), pg.RESIZABLE)
Or make checks:
if not settings.fullscreen:
pass