Help! I’m coding a game program for my daughter and I come up with the following error:
Traceback (most recent call last):
File “/home/roberto-padilla/mystuff/ella_game.py”, line 193, in
a_game.play()
File “/home/roberto-padilla/mystuff/ella_game.py”, line 22, in play
next_scene_name = current_scene.enter()
^^^^^^^^^^^^^^^^^^^
AttributeError: ‘tuple’ object has no attribute ‘enter’
Here’s the code:
class Engine(object):
def __init__(self, scene_map):
self.scene_map = scene_map
def play(self):
current_scene = self.scene_map.opening_scene()
last_scene = self.scene_map.next_scene('finished')
while current_scene != last_scene:
next_scene_name = current_scene.enter()
current_scene = self.scene_map.next_scene(next_scene_name)
current_scene.enter()
class Map(object):
scenes = {
'outside_house': OutsideHouse(),
'kitchen': Kitchen(),
'foyer': Foyer(),
'living_room': LivingRoom(),
'dark_woods': DarkWoods(),
'cellar': Cellar(),
'witch_house': WitchHouse(),
'death': Death(),
'finished': Finished(),
}
def __init__(self, start_scene):
self.start_scene = start_scene
def next_scene(self, scene_name):
val = Map.scenes.get(scene_name)
return val
def opening_scene(self):
have_bone = False
return self.next_scene(self.start_scene), have_bone
a_map = Map('outside_house')
a_game = Engine (a_map)
a_game.play()
Any help would be greatly taken and appreciated. Thanks in advance for your help!