I am trying to show scene images based on the current location in the game and got some issues. I found a post on these forums dealing with this but am unable to implement it correctly.
I have a dictionary with possible places:
Code: Select all
default current_place = {
"room_1":False,
"room_2":False,
}
Code: Select all
# enter place
def enter_place(place):
global bg_code
for x in current_place: # safeguard, leave all and any current places
current_place[x] = False
current_place[place] = True # switch to True for chosen location
bg_code = current_place.index(place)
Code: Select all
room_1 = "bg_room_1.png",
room_2 = "bg_room_2.png",
places_list = [
room_1,
room_2,
]
Code: Select all
$ enter_place("room_1")
scene places_list[bg_code] # display correct picture
It feels like I am almost there but fail to pair the bg_code with choosing the correct image. Thank you for your time.