Dec-15-2016, 03:27 AM
I'll remember that the next time nilamo. Thanks.
So, I tried your suggestion, but I still got the same error:
Cheers,
So, I tried your suggestion, but I still got the same error:
Error:Traceback (most recent call last):
File "ex43_mine.py", line 253, in <module>
a_game.play()
File "ex43_mine.py", line 44, in play
next_scene_name = current_scene.enter()
File "ex43_mine.py", line 66, in enter
loaded_alien = load_alien('central_corridor')
NameError: global name 'load_alien' is not defined
My Aliens class now looks like this, with the rest the same as before:class Alien(object): def __init__(self, alien_name, alien_lair): self.alien_name = alien_name self.alien_lair = alien_lair self.health = 2 aliens = { 'central_corridor': 'puppeteer', 'laser_weapon_armory': 'kzin', 'the_bridge': 'trooper', 'escape_pod': 'predator', } # loads corresponding alien onto scene def load_alien(self, alien_lair): alien = self.aliens(alien_lair) return alienAlso, shouldn't get() be used to return the key value from the dict, which in this case is the alien itself? I'm using lines 230-232 as a point of reference here.
Cheers,