def init(self): self.random = 0 self.init_play() self.lcur = 0 self.scale2x = SCALE2X if '-scale2x' in sys.argv: self.scale2x = not self.scale2x self.lowres = LOWRES if '-lowres' in sys.argv: self.lowres = not self.lowres self.vsync = VSYNC if '-vsync' in sys.argv: self.vsync = not self.vsync sw, sh = SW, SH if not self.lowres: sw, sh = sw * 2, sh * 2 mode = 0 if FULL: mode |= FULLSCREEN if '-full' in sys.argv: mode ^= FULLSCREEN if mode & FULLSCREEN: mode |= HWSURFACE | DOUBLEBUF self.screen = pygame.display.set_mode((sw, sh), mode) if mode & FULLSCREEN: pygame.mouse.set_visible(False) pygame.display.set_caption(TITLE) self.timer = timer.Timer(FPS) # self.timer = timer.Speedometer() pygame.joystick.init() joy_count = pygame.joystick.get_count() for joynum in range(joy_count): joystick = pygame.joystick.Joystick(joynum) joystick.init() self.input = Input() if not self.lowres: self._screen = self.screen self.screen = self._screen.convert().subsurface(0, 0, SW, SH) pygame.font.init() f_main = data.filepath(os.path.join('fonts', '04B_20__.TTF')) f_scale = 0.35 # f_main = data.filepath(os.path.join('fonts','04B_25__.TTF')) # f_scale = 0.75 # f_main = data.filepath(os.path.join('fonts','04B_11__.TTF')) # f_scale = 0.67 self.fonts = {} self.fonts['intro'] = pygame.font.Font(f_main, int(36 * f_scale)) # self.fonts['intro2'] = pygame.font.Font(data.filepath(os.path.join('fonts','vectroid.ttf')),72) # self.fonts['title'] = pygame.font.Font(data.filepath(os.path.join('fonts','vectroid.ttf')),32) self.fonts['help'] = pygame.font.Font(f_main, int(24 * f_scale)) self.font = self.fonts['menu'] = pygame.font.Font( f_main, int(24 * f_scale)) self.fonts['level'] = pygame.font.Font(f_main, int(24 * f_scale)) self.fonts['pause'] = pygame.font.Font(f_main, int(36 * f_scale)) import level level.pre_load() try: if '-nosound' in sys.argv: 1 / 0 # stop crackling sound on some windows XP machines. if os.name == 'posix' or 1: try: pygame.mixer.pre_init(44100, -16, 2, 1024 * 3) except: pygame.mixer.pre_init() else: pygame.mixer.pre_init() pygame.mixer.init() except: print 'mixer not initialized' self._music_name = None self.sfx = {} for name in [ 'bubble', 'capsule', 'coin', 'hit', 'item', 'powerup', 'pop', 'jump', 'explode', 'door', 'fally', 'boss_explode' ]: self.sfx[name] = Sound( data.filepath(os.path.join('sfx', '%s.wav' % name)))
def init(self): self.random = 0 self.init_play() self.lcur = 0 self.scale2x = SCALE2X if '-scale2x' in sys.argv: self.scale2x = not self.scale2x sw,sh = SW,SH if self.scale2x: sw,sh = sw*2,sh*2 mode = FULLSCREEN if '-full' in sys.argv: mode ^= FULLSCREEN self.screen = pygame.display.set_mode((sw,sh),mode) pygame.display.set_caption(TITLE) #self.timer = timer.Timer(FPS) self.timer = timer.Timer(FPS) #self.timer = timer.Speedometer() pygame.joystick.init() joy_count = pygame.joystick.get_count() for joynum in range(joy_count): joystick = pygame.joystick.Joystick(joynum) joystick.init() self.input = Input() if self.scale2x: self._screen = self.screen self.screen = self._screen.convert().subsurface(0,0,SW,SH) pygame.font.init() self.fonts = {} self.fonts['intro'] = pygame.font.Font(data.filepath(os.path.join('fonts','LESSERCO.ttf')),36) self.fonts['intro2'] = pygame.font.Font(data.filepath(os.path.join('fonts','vectroid.ttf')),72) self.fonts['title'] = pygame.font.Font(data.filepath(os.path.join('fonts','vectroid.ttf')),32) self.fonts['help'] = pygame.font.Font(data.filepath(os.path.join('fonts','LESSERCO.ttf')),24) self.font = self.fonts['menu'] = pygame.font.Font(data.filepath(os.path.join('fonts','LESSERCO.ttf')),24) self.fonts['level'] = pygame.font.Font(data.filepath(os.path.join('fonts','LESSERCO.ttf')),24) self.fonts['pause'] = pygame.font.Font(data.filepath(os.path.join('fonts','LESSERCO.ttf')),36) import level level.pre_load() try: if '-nosound' in sys.argv: 1/0 # stop crackling sound on some windows XP machines. if os.name == 'posix' or 1: try: pygame.mixer.pre_init(44100,-16,2, 1024*3) except: pygame.mixer.pre_init() else: pygame.mixer.pre_init() pygame.mixer.init() except: print 'mixer not initialized' self._music_name = None self.sfx = {} for name in ['bubble','capsule','coin','hit','item','powerup', 'pop','jump','explode','door','fally','boss_explode']: self.sfx[name] = Sound(data.filepath(os.path.join('sfx','%s.wav'%name)))
def init(self): self.random = 0 self.init_play() self.lcur = 0 self.scale2x = SCALE2X if '-scale2x' in sys.argv: self.scale2x = not self.scale2x self.lowres = LOWRES if '-lowres' in sys.argv: self.lowres = not self.lowres sw,sh = SW,SH if not self.lowres: sw,sh = sw*2,sh*2 mode = 0 if FULL: mode |= FULLSCREEN if '-full' in sys.argv: mode ^= FULLSCREEN self.screen = pygame.display.set_mode((sw,sh),mode) pygame.display.set_caption(TITLE) self.timer = timer.Timer(FPS) #self.timer = timer.Speedometer() pygame.joystick.init() joy_count = pygame.joystick.get_count() for joynum in range(joy_count): joystick = pygame.joystick.Joystick(joynum) joystick.init() self.input = Input() if not self.lowres: self._screen = self.screen self.screen = self._screen.convert().subsurface(0,0,SW,SH) pygame.font.init() f_main = data.filepath(os.path.join('fonts','04B_20__.TTF')) f_scale = 0.35 #f_main = data.filepath(os.path.join('fonts','04B_25__.TTF')) #f_scale = 0.75 #f_main = data.filepath(os.path.join('fonts','04B_11__.TTF')) #f_scale = 0.67 self.fonts = {} self.fonts['intro'] = pygame.font.Font(f_main,int(36*f_scale)) #self.fonts['intro2'] = pygame.font.Font(data.filepath(os.path.join('fonts','vectroid.ttf')),72) #self.fonts['title'] = pygame.font.Font(data.filepath(os.path.join('fonts','vectroid.ttf')),32) self.fonts['help'] = pygame.font.Font(f_main,int(24*f_scale)) self.font = self.fonts['menu'] = pygame.font.Font(f_main,int(24*f_scale)) self.fonts['level'] = pygame.font.Font(f_main,int(24*f_scale)) self.fonts['pause'] = pygame.font.Font(f_main,int(36*f_scale)) import level level.pre_load() try: if '-nosound' in sys.argv: 1/0 # stop crackling sound on some windows XP machines. if os.name == 'posix' or 1: try: pygame.mixer.pre_init(44100,-16,2, 1024*3) except: pygame.mixer.pre_init() else: pygame.mixer.pre_init() pygame.mixer.init() except: print 'mixer not initialized' self._music_name = None self.sfx = {} for name in ['shoot','capsule','coin','hit','item','powerup', 'pop','jump','explode','door','fally','boss_explode']: self.sfx[name] = Sound(data.filepath(os.path.join('sfx','%s.wav'%name)))
def init(self): self.random = 0 self.init_play() self.lcur = 0 self.scale2x = SCALE2X if '-scale2x' in sys.argv: self.scale2x = not self.scale2x self.lowres = LOWRES if '-lowres' in sys.argv: self.lowres = not self.lowres sw, sh = SW, SH if not self.lowres: sw,sh = sw * 2, sh * 2 mode = 0 if FULL: mode |= FULLSCREEN if '-full' in sys.argv: mode ^= FULLSCREEN self.screen = pygame.display.set_mode((sw,sh), mode, 16) pygame.display.set_caption(TITLE) self.timer = timer.Timer(FPS) #self.timer = timer.Speedometer() pygame.joystick.init() joy_count = pygame.joystick.get_count() for joynum in range(joy_count): joystick = pygame.joystick.Joystick(joynum) joystick.init() self.input = Input() if not self.lowres: self._screen = self.screen self.screen = self._screen.convert().subsurface(0, 0, SW, SH) pygame.font.init() f_main = data.filepath(os.path.join('fonts', '04B_20__.TTF')) f_scale = 0.35 self.fonts = {} self.fonts['intro'] = pygame.font.Font(f_main, int(36 * f_scale)) self.fonts['help'] = pygame.font.Font(f_main, int(24*f_scale)) self.font = self.fonts['menu'] = pygame.font.Font( f_main,int(24 * f_scale)) self.fonts['level'] = pygame.font.Font(f_main,int(24*f_scale)) self.fonts['pause'] = pygame.font.Font(f_main,int(36*f_scale)) import level level.pre_load() if not '-nosound' in sys.argv: try: if os.name == 'posix' or 1: try: pygame.mixer.pre_init(44100,-16,2, 1024*3) except: pygame.mixer.pre_init() else: pygame.mixer.pre_init() pygame.mixer.init() except: debug('E: No se pudo inicializar el sonido') else: debug('I: Sonido no inicializado') self._music_name = None self.sfx = {} for name in [ 'boss_explode.wav', 'bubble.wav', 'capsule.wav', 'coin.wav', 'door.ogg', 'explode.wav', 'fally.wav', 'hit.wav', 'item.wav', 'jump.wav', 'pop.wav', 'powerup.wav', ]: self.sfx[name.split(".")[0]] = Sound(data.filepath( os.path.join('sfx', name)))