def add_EHID41K(self): _odds = float(self.level_num - 2) / 4 _r = random() if _r < _odds: self.dm.player.events.append('EHID41K') _droid = ExperimentalHoboInfiltrationDroid41K(self.dm, 0, 0) GameLevel.add_monster(self, _droid)
def add_monster(self, monster=''): rnd = randrange(0,3) if rnd == 0: _m = MonsterFactory.get_monster_by_name(self.dm,'turkey vulture',0, 0) elif rnd == 1: _m = MonsterFactory.get_monster_by_name(self.dm,'junkie', 0, 0) else: _m = MonsterFactory.get_monster_by_name(self.dm,'rabid dog', 0, 0) GameLevel.add_monster(self, _m)
def add_monster(self): _monster_level = self.level_num if _monster_level > 2: rnd = random() if rnd < 0.05: _monster_level += 3 elif rnd < 0.10: _monster_level += 2 elif rnd < 0.20: _monster_level += 1 elif rnd > 0.95: _monster_level -= 1 GameLevel.add_monster(self, self.__get_monster(_monster_level))
def generate_level(self): self.map = [] self.length = 60 self.width = 80 self.complex_length = 50 self.complex_width = 70 self.__tf = TerrainFactory() _ca = CA_CaveFactory(self.length, self.width, 0.50) self.map = _ca.gen_map([False,False]) self.__generate_complex() self.downStairs = '' add_science_complex_rooms(self.dm, self, self) self.__set_east_wall() self.__add_pools() self.__add_monsters() self.__add_items_to_level() GameLevel.add_monster(self, Roomba3000(self.dm, 0, 0))
def main(winstyle=0): if pygame.get_sdl_version()[0] == 2: pygame.mixer.pre_init(44100, 32, 2, 1024) pygame.init() winstyle = 0 bestdepth = pygame.display.mode_ok(SCREENRECT.size, winstyle, 32) screen = pygame.display.set_mode(SCREENRECT.size, winstyle, bestdepth) set_game_obj_images() pygame.mouse.set_visible(0) background_tile_image = Utility.load_image("background.gif") background = pygame.Surface(SCREENRECT.size) for x_position in range(0, SCREENRECT.width, background_tile_image.get_width()): background.blit(background_tile_image, (x_position, 0)) screen.blit(background, (0, 0)) pygame.display.flip() set_game_sound() aliens = pygame.sprite.Group() shots = pygame.sprite.Group() bombs = pygame.sprite.Group() all_game_rects = pygame.sprite.RenderUpdates() Player.containers = all_game_rects Alien.containers = aliens, all_game_rects Shot.containers = shots, all_game_rects Bomb.containers = bombs, all_game_rects Explosion.containers = all_game_rects Score.containers = all_game_rects Score.score_points = 0 PlayerLives.containers = all_game_rects PlayerLives.lives = 5 GameLevel.containers = all_game_rects GameLevel.level = 1 Alien(SCREENRECT) if (pygame.font is not None): all_game_rects.add(Score()) all_game_rects.add(PlayerLives()) all_game_rects.add(GameLevel()) clock = game_loop(all_game_rects, screen, background, shots, aliens, bombs, winstyle, bestdepth, FULLSCREEN) game_over(screen, clock)
def add_monster(self): GameLevel.add_monster(self, self.__get_monster())
def activate_security_program(self): _scp = SecurityControlProgram(self.dm, 0, 0, self.level_num) GameLevel.add_monster(self, _scp)
def __init__(self, dm, level_num, length, width): GameLevel.__init__(self, dm, level_num, length, width, 'cyberspace') self.melee = CyberspaceCombatResolver(dm, dm.dui)
def __init__(self, dm, level_num, length, width): GameLevel.__init__(self, dm, level_num, length, width, 'mines')
def __init__(self, dm, level_num, length, width): GameLevel.__init__(self, dm, level_num, length, width, 'proving grounds')
def add_monster(self): _monster = self.__get_monster() GameLevel.add_monster(self, _monster)
def __init__(self, dm, level_num, length, width): GameLevel.__init__(self, dm, level_num, length, width, 'old complex')
def dispatch_security_bots(self): for x in range(randrange(1,6)): GameLevel.add_monster(self, MonsterFactory.get_monster_by_name(self.dm,'damaged security bot',0,0))
def add_monster(self): _monster = self.__get_monster() GameLevel.add_monster(self, _monster) if _monster.get_name(True).startswith('pigoon'): self.add_pack('pigoon', 2, 4, _monster.row, _monster.col)
def __init__(self, dm): GameLevel.__init__(self, dm, 0, 30, 70, 'prologue')