To add to this.
When the death scene occurs in the wire scene it only prints the first item of the list, but when I die in the escape pod scene it prints all the other ones.
Has anyone else had this problem?
Another question I had was:
When I run this code:
a_map = Map('central_corridor')
Does it put the equivalent of central_corridor’s key as parameter on all the second arguments after self in the code below?
def __init__(self, start_scene):
self.start_scene = start_scene
def next_scene(self, scene_name):
val = Map.scenes.get(scene_name)
On top of this:
How is it that if i make the variable ‘health’ in the scene class that i get the following error:
Traceback (most recent call last):
File “C:\Users\user\pythonlearn\ex43.py”, line 166, in
File “C:\Users\user\pythonlearn\ex43.py”, line 24, in play
next_scene_name = current_scene.enter()
File “C:\Users\user\pythonlearn\ex43.py”, line 55, in enter
while action == “shoot” and health >= 0:
UnboundLocalError: local variable ‘health’ referenced before assignment.
But when I put it in the class which I am actually running it does work. I thought the daughter class was supposed to “Inherit” everything from the mother class.