コード例 #1
0
ファイル: TypeHero.py プロジェクト: Zel9689/Typehero
                p1.isUp = 0
            if (event.key == pygame.K_DOWN):
                p1.isDown = 0
            if (event.key == pygame.K_LEFT):
                p1.isLeft = 0
            if (event.key == pygame.K_RIGHT):
                p1.isRight = 0
            if (event.key == pygame.K_BACKSPACE):
                isHoldBackspace = False
    [i.updateCoordinate() for i in GO.Players]
    [i.fly() for i in GO.Bullets if i.isFired is True]
    [
        GO.Bullets.remove(i) for i in GO.Bullets
        if (i.isFired is True and i.isOutOfScreen())
    ]
    GO.CollisionDetection()
    # 暴露在main loop的setTimeout記得在TimerFlags加一個True
    GO.setTimeout(lambda: print('setTimeout 5s'), 5000, 0)
    if (isHoldBackspace
            and pygame.time.get_ticks() - HoldBackspaceTick >= 400):
        p1.input = p1.input[:-1]
        print(p1.input)

    ## 背景移動
    # bg.move((-5, 0))
    # bg2.move((-5, 0))
    # if(bg.position[0] + bg.Rect.right <= 0):
    #     bg.moveto((1280, 0))
    # if(bg2.position[0] + bg2.Rect.right <= 0):
    #     bg2.moveto((1280, 0))
    ## 執行延時任務