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


Python Module.draw方法代码示例

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


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

示例1: JumpGame

# 需要导入模块: from module import Module [as 别名]
# 或者: from module.Module import draw [as 别名]

#.........这里部分代码省略.........
            JumpGame.trainingMousePressed(self,event)
        elif(self.mode == "race"):
            JumpGame.raceMousePressed(self,event)


    def keyPressed(self,event):
        if (self.mode == "mainmenu"):
            JumpGame.mainmenuKeyPressed(self,event)
        elif (self.mode == "spacejump"):
            JumpGame.spacejumpKeyPressed(self,event)
        elif (self.mode == "instructions"):
            JumpGame.instructionsKeyPressed(self,event)
        elif (self.mode == "instructions2:"):
            JumpGame.instructionstwoKeyPressed(self,event)
        elif (self.mode == "training"):
            JumpGame.trainingKeyPressed(self,event)
        elif(self.mode=="race"):
            JumpGame.raceKeyPressed(self,event)

    def timerFired(self):
        if (self.mode == "mainmenu"):
            JumpGame.mainmenuTimerFired(self)
        elif (self.mode == "spacejump"):
            JumpGame.spacejumpTimerFired(self)
        elif (self.mode == "instructions"):
            JumpGame.instructionsTimerFired(self)
        elif (self.mode == "instructionstwo"):
            JumpGame.instructionstwoTimerFired(self)
        elif (self.mode == "training"):
            JumpGame.trainingTimerFired(self)
        elif (self.mode == "race"):
            JumpGame.raceTimerFired(self)

    def redrawAll(self):
        if (self.mode == "mainmenu"):
            JumpGame.mainmenuRedrawAll(self)
        elif (self.mode == "spacejump"):
            JumpGame.spacejumpRedrawAll(self)
        elif (self.mode == "instructions"):
            JumpGame.instructionsRedrawAll(self)
        elif (self.mode == "instructionstwo"):
            JumpGame.instructionstwoRedrawAll(self)
        elif (self.mode == "training"):
            JumpGame.trainingRedrawAll(self)
        elif (self.mode == "race"):
            JumpGame.raceRedrawAll(self)

###### main menu ######


    def mainmenuMousePressed(self,event):
        # if click is in range, then change mode.
        if event.x > self.width//2-30 and event.x < self.width//2+30 and\
        event.y > self.height//2-15 and event.y < self.height//2+15:
            self.mode = "spacejump"
        elif event.x > self.width//2-45 and event.x < self.width//2+45 and\
        event.y>self.height//2+30 and event.y<self.height//2+60:
            self.mode = "instructions"
        elif event.x >= self.width//2-40 and event.x <= self.width//2+40 and\
        event.y>=self.height//2+75 and event.y<=self.height//2+105:
            self.mode = "training"
        elif event.x >= self.width//2-30 and event.x <= self.width//2+30 and\
        event.y>=self.height//2+120 and event.y<=self.height//2+150:
            self.mode = "race"

开发者ID:edwardang,项目名称:Space-Jump,代码行数:68,代码来源:jump.py


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