def __init__(self, x, y, angle, hits=0, speed=0, life_count=5, frequency_fire=0.5, obj_type='', bullet_type=UNITS.get('bullet_hero', {}).get('type', ''), dimension=0, controller=None): if not obj_type and len(UNITS.get('hero', [])): random_number = randint(0, len(UNITS.get('hero', [])) - 1) obj_type = UNITS.get('hero', [])[random_number].get('type', '') dimension = UNITS.get('hero', [])[random_number].get('dimension', '') super(Hero, self).__init__(x, y, angle, hits, speed, obj_type, bullet_type, dimension, controller=controller) self.frequency_fire = frequency_fire self.last_fire = datetime.now() self.life_count = life_count self.name = None
def __init__(self, x, y, angle, hits=10, speed=DEFAULT_SPEED, obj_type='', bullet_type=UNITS.get('bullet_invader', {}).get('type', ''), dimension=0, controller=None): if not obj_type and len(UNITS.get('invader', [])): random_number = randint(0, len(UNITS.get('invader', [])) - 1) obj_type = UNITS.get('invader', [])[random_number].get('type', '') dimension = UNITS.get('invader', [])[random_number].get('dimension', '') super(Invader, self).__init__(x, y, angle, hits, speed, obj_type, bullet_type, dimension, controller=controller)
def get_bullet_dimension(self): """ Get dimension for Invader object. """ return UNITS.get('bullet_invader', {}).get('dimension', 0)
def get_bullet_dimension(self): """ Get dimension for Hero object. """ return UNITS.get('bullet_hero', {}).get('dimension', 0)