def __init__(self,level): State.__init__(self) self.level = level self.audio = Audio() self.audio.volume = 0.5 self.music = Music() self.music.volume = 0.7 seconds = 5 self.delay = seconds*40
def start(self): self.music.stop(500) self.music.play('data/sounds/loser.wav') fnt = pygame.font.SysFont('Verdana',30,italic=True) text = fnt.render('You Got Knocked Out!',True,(255,0,0)) disp = pygame.display.get_surface() disp.blit(text,(400-text.get_width()/2, 300-text.get_height()/2)) pygame.display.flip() State.start(self)
def start(self): self.music.stop(500) self.music.play('data/sounds/winner.wav') fnt = pygame.font.SysFont('Verdana',30,italic=True) text = fnt.render('Level Completed!',True,(0,255,0)) disp = pygame.display.get_surface() disp.blit(text,(400-text.get_width()/2, 300-text.get_height()/2)) pygame.display.flip() State.start(self)
def __init__(self): State.__init__(self) self.audio = Audio() self.audio.volume = 0.5 self.music = Music() self.music.volume = 0.7 self.music.stop(500) self.delay = 10*40 self.playing = False self.image = data.candy self.image.set_alpha(0)
def __init__(self,lvl=None): State.__init__(self) if lvl == None: self.level = level.load(Campaign.next()) else: self.level = lvl self.bg = pygame.sprite.Group(self.level.s) self.selected = None self.audio = Audio() self.music = Music() self.music.volume = 1 self.audio.volume = 0.5 self.alarm = 0 self.music.stop(500) self.music.play('data/music/play.ogg',-1) self.playing = True
def quit(self,next=None): self.audio.stop(500) self.music.stop(500) self.music.play('data/music/menu.ogg',-1) State.quit(self,next)
def start(self): State.start(self) self.EVT_tick(None) self.playing = False pygame.display.get_surface().blit(self.level.intro(),(0,0)) pygame.display.flip()
def start(self): State.start(self) self.music.play('data/sounds/winner.wav') pygame.display.get_surface().fill((0,0,0)) pygame.display.get_surface().blit(self.intro(),(0,0)) pygame.display.flip()
def __init__(self): State.__init__(self) if len(sys.argv) == 2: self.filename = sys.argv[1] self.level = level.load(self.filename) else: print 'usage: python %s <level>' % sys.argv[0] sys.exit() pygame.display.set_icon(data.icon) pygame.display.set_caption('Level Editor') self.bg = pygame.sprite.Group(self.level.s) self.buttons = pygame.sprite.Group() self.playerBtn = pygame.sprite.Sprite() self.playerBtn.image = data.Hero.button self.playerBtn.rect = self.playerBtn.image.get_rect() self.playerBtn.rect.topleft = (10,10) self.floorBtn = pygame.sprite.Sprite() self.floorBtn.image = self.level.tileset.floor self.floorBtn.rect = self.floorBtn.image.get_rect() self.floorBtn.rect.topleft = (10,self.playerBtn.rect.bottom+10) self.wallBtn = pygame.sprite.Sprite() self.wallBtn.image = self.level.tileset.wall self.wallBtn.rect = self.wallBtn.image.get_rect() self.wallBtn.rect.topleft = (10,self.floorBtn.rect.bottom+10) self.camBtn = pygame.sprite.Sprite() self.camBtn.image = data.Camera.still self.camBtn.rect = self.camBtn.image.get_rect() self.camBtn.rect.topleft = (10,self.wallBtn.rect.bottom+10) self.stairBtn = pygame.sprite.Sprite() self.stairBtn.image = self.level.tileset.stair self.stairBtn.rect = self.stairBtn.image.get_rect() self.stairBtn.rect.topleft = (10,self.camBtn.rect.bottom+10) self.enemyBtn = pygame.sprite.Sprite() self.enemyBtn.image = data.Enemy.button self.enemyBtn.rect = self.enemyBtn.image.get_rect() self.enemyBtn.rect.topleft = (10,self.stairBtn.rect.bottom+10) self.exitBtn = pygame.sprite.Sprite() self.exitBtn.image = self.level.tileset.exitDoor self.exitBtn.rect = self.exitBtn.image.get_rect() self.exitBtn.rect.topleft = (10,self.enemyBtn.rect.bottom+10) self.saveBtn = pygame.sprite.Sprite() self.saveBtn.image = font.render('Save',True,(255,255,255)) self.saveBtn.rect = self.saveBtn.image.get_rect() self.saveBtn.rect.topleft = (10,self.exitBtn.rect.bottom+10) self.buttons.add(self.playerBtn, self.floorBtn, self.wallBtn, self.camBtn, self.stairBtn, self.enemyBtn, self.exitBtn, self.saveBtn) self.keys = [0,0,0,0] self.selected = None self.cursor = None self.level.player.release()