当前位置: 首页>>代码示例>>Python>>正文


Python Menu.display_frame方法代码示例

本文整理汇总了Python中menu.Menu.display_frame方法的典型用法代码示例。如果您正苦于以下问题:Python Menu.display_frame方法的具体用法?Python Menu.display_frame怎么用?Python Menu.display_frame使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在menu.Menu的用法示例。


在下文中一共展示了Menu.display_frame方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Game

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import display_frame [as 别名]

#.........这里部分代码省略.........
            if len(coins) < 2:
                coins = "0" + coins
            i = 50
            for n in coins:
                screen.blit(self.number_image(int(n)),((SCREEN_WIDTH / 2)+i,10))
                i += 35
            # ----------------------------------------------------------
            text = self.text_font.render("World:",True,(128,128,128))
            screen.blit(text,(SCREEN_WIDTH - 180,10)) 
            screen.blit(self.number_image(self.currentLevel +1),(SCREEN_WIDTH - 50,10))
            
            if self.win_message:
                text = self.text_font.render("You Won!",True,(128,128,255))
                screen.blit(text,(30,300))
                pygame.display.flip() 
                pygame.time.wait(3000)
                self.running = False
                self.win_message = False
        elif self.about_menu:
            self.screen.blit(images["intro"],(0,0))
            text = self.text_font.render("Author: Eduardo Alejandro Grando",True,(128,128,255))
            screen.blit(text,(30,0))
            text = self.text_font.render("Platformer graphics: Kenney Vleugels",True,(128,128,255))
            screen.blit(text,(5,125))
            text = self.text_font.render("press ESC to go back to the menu",True,(128,128,255))
            screen.blit(text,(30,300))
        elif self.game_over:
            self.screen.blit(images["intro"],(0,0))
            text = self.text_font.render("GAME OVER",True,(128,128,255))
            screen.blit(text,(250,125))
            text = self.text_font.render("press ESC to go back to the menu",True,(128,128,255))
            screen.blit(text,(30,300)) 
        else:
            self.menu.display_frame()
    #-------------------------------------------------------------------
    def number_image(self,n):
        """ return a image with the number given in it. """
        if n == 1:
            return images["hud_1"]
        elif n == 2:
            return images["hud_2"]
        elif n == 3:
            return images["hud_3"]
        elif n == 4:
            return images["hud_4"]
        elif n == 5:
            return images["hud_5"]
        elif n == 6:
            return images["hud_6"]
        elif n == 7:
            return images["hud_7"]
        elif n == 8:
            return images["hud_8"]
        elif n == 9:
            return images["hud_9"]
        else:
            return images["hud_0"]
    #-------------------------------------------------------------------
    def eventHandler(self):
        flag = False
        for event in pygame.event.get(): # User did something
            if event.type == pygame.QUIT: # If user clicked close
                flag = True # Flag that we are done so we exit this loop
                pygame.mixer.music.stop()
            #---------KEY DOWN EVENTS-----------------------------------
            if event.type == pygame.KEYDOWN:
开发者ID:edward344,项目名称:alien_adventure,代码行数:70,代码来源:game_class.py

示例2: Game

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import display_frame [as 别名]

#.........这里部分代码省略.........
            else:
                screen.blit(images["hud_0"],(110,10))
                
            screen.blit(images["hud_coin"],((SCREEN_WIDTH / 2) -60,10))
            screen.blit(images["hud_x"],(SCREEN_WIDTH /2,20))
            
            # draw the number of coins collected: ----------------------
            coins = str(self.player.coins)
            if len(coins) < 2:
                coins = "0" + coins
            i = 50
            for n in coins:
                screen.blit(self.number_image(int(n)),((SCREEN_WIDTH / 2)+i,10))
                i += 35
            # ----------------------------------------------------------
            
            if self.win_message:
                text = self.text_font.render("GANASTE!!",True,(128,128,255))
                screen.blit(text,(30,300))
                pygame.display.flip() 
                pygame.time.wait(3000)
                self.running = False
                self.win_message = False
        elif self.opciones_menu:
            self.screen.blit(images["intro"],(0,0))
	elif self.ayuda_menu:
            self.screen.blit(images["intro"],(0,0))
	    text = self.text_font.render("La respuesta esta en tu corazon",True,(128,128,255))
            screen.blit(text,(30,300))
	elif self.continuar_menuPausa:
            self.pausa = False
	    self.running = True
	elif self.menu_menuPausa:
            self.menu.display_frame()
	    self.menu1 = True
	    self.pausa = False
        elif self.game_over:
            self.screen.blit(images["intro"],(0,0))
            text = self.text_font.render("GAME OVER",True,(128,128,255))
            screen.blit(text,(250,125))
            text = self.text_font.render("presiona ESC para ir menu",True,(128,128,255))
            screen.blit(text,(30,300)) 
        else:
	    if self.menu1:
            	self.menu.display_frame()
	    if self.pausa:
		self.menuPausa.display_frame()
    #-------------------------------------------------------------------
    def number_image(self,n):
        """ return a image with the number given in it. """
        if n == 1:
            return images["hud_1"]
        elif n == 2:
            return images["hud_2"]
        elif n == 3:
            return images["hud_3"]
        elif n == 4:
            return images["hud_4"]
        elif n == 5:
            return images["hud_5"]
        elif n == 6:
            return images["hud_6"]
        elif n == 7:
            return images["hud_7"]
        elif n == 8:
            return images["hud_8"]
开发者ID:karen-lopez,项目名称:computacionGrafica,代码行数:70,代码来源:juego.py


注:本文中的menu.Menu.display_frame方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。