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


Python Player.go方法代码示例

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


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

示例1: BackGround

# 需要导入模块: import Player [as 别名]
# 或者: from Player import go [as 别名]
    
    BackGround("RSC/Background/Illuminati.png", True, [0,-1])

    score = Score([width-300, height-25], "Score: ", 80)

    spawnRate = .3 #seconds

    player1 = Player((width/2, height/2), 1)
    player2 = Player((width/2, height/2), 2)

    while run == "game":
        for event in pygame.event.get():
            if event.type == pygame.QUIT: sys.exit()
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_w:
                    player1.go("up")
                if event.key == pygame.K_UP:
                    player2.go("up")
                if event.key == pygame.K_d:
                    player1.go("right")
                if event.key == pygame.K_RIGHT:
                    player2.go("right")
                if event.key == pygame.K_s:
                    player1.go("down")
                if event.key == pygame.K_DOWN:
                    player2.go("down")
                if event.key == pygame.K_a:
                    player1.go("left")
                if event.key == pygame.K_LEFT:
                    player2.go("left")
                if event.key == pygame.K_SPACE:
开发者ID:KRHS-GameProgramming-2014,项目名称:adventure-swag,代码行数:33,代码来源:Game.py

示例2: Player

# 需要导入模块: import Player [as 别名]
# 或者: from Player import go [as 别名]
zombieTimer = 0
zombieTimerMax = .75 * 60
zombieLimit = 5

bgImage = pygame.image.load("Backgrounds/Room1.png")
bgRect = bgImage.get_rect()

player = Player([width/2, height/2])

while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            sys.exit()
        elif event.type == pygame.KEYDOWN:
            if event.key == pygame.K_UP:
                player.go("up")
            elif event.key == pygame.K_DOWN:
                player.go("down")
            elif event.key == pygame.K_LEFT:
                player.go("left")
            elif event.key == pygame.K_RIGHT:
                player.go("right")
            elif event.key == pygame.K_a:
                player.go("attack")
        elif event.type == pygame.KEYUP:
            if event.key == pygame.K_UP:
                player.go("stop up")
            elif event.key == pygame.K_DOWN:
                player.go("stop down")
            elif event.key == pygame.K_LEFT:
                player.go("stop left")
开发者ID:rcnerd,项目名称:JourneyThroughHell,代码行数:33,代码来源:JTH.py


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