def __init__(self, resourcemgr, team, level): super(InGame, self).__init__(resourcemgr) self.tilemgr = TileManager(resourcemgr, level) self.unitmgr = UnitManager(resourcemgr, STATES.INGAME, team, level) self.lw = self.tilemgr.lw self.lh = self.tilemgr.lh self.team = team # self.bar = Bar(config) music.load(os.path.join(resourcemgr.main_path, 'sound/yyz.ogg')) self.camera = Camera(0, 0, self.lw, self.lh, resourcemgr) font = SysFont(FONTS, int(48 * resourcemgr.scale), True) self.win_msg = font.render('YOU WINNN!!! GGGG GGGGGGGGGGGGGGG', 1, WHITE) self.win_msg_rect = self.win_msg.get_rect( centerx=self.camera.rect.w / 2, centery=self.camera.rect.h / 4) self.lose_msg = font.render('You lost. What the f**k, man?', 1, BLACK) self.lose_msg_rect = self.win_msg.get_rect( centerx=self.camera.rect.w / 2, centery=self.camera.rect.h / 4) self.mouse_rect = Rect(0, 0, 0, 0) self.x_first = 0 self.y_first = 0 self.won = False self.lost = False self.gg = load_sound(resourcemgr.main_path, 'gg.ogg') self.lose = load_sound(resourcemgr.main_path, 'lose.ogg')
def __init__(self): self.init_paths() self.init_config() self.init_screen() self.unit_images = {} self.scaled_unit_images = {} for u in UNITS: self.unit_images[u] = load_image(self.main_path, 'units/%s.png' % u, -1) self.tile_images = {} self.scaled_tile_images = {} for s in TILE_SHEETS: self.tile_images[s] = load_image(self.main_path, 'tiles/%s.png' % s) self.button_images = {} self.scaled_button_images = {} for b in BUTTONS: self.button_images[b] = load_image(self.main_path, 'buttons/%s.png' % b, -1) self.background_images = {} self.scaled_background_images = {} for b in BACKGROUNDS: self.background_images[b] = load_image(self.main_path, 'backgrounds/%s.jpg' % b) self.unit_sounds = {} for u in UNITS: self.unit_sounds[u] = {} self.unit_sounds[u]['move'] = load_sound(self.main_path, 'units/%s.move.ogg' % u) self.unit_sounds[u]['fire'] = load_sound(self.main_path, 'units/%s.fire.ogg' % u) self.unit_sounds[u]['target'] = load_sound(self.main_path, 'units/%s.target.ogg' % u) self.unit_sounds[u]['die'] = load_sound(self.main_path, 'units/%s.die.ogg' % u) self.update_scale()