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


Python Dialog.message方法代码示例

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


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

示例1: scence1

# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import message [as 别名]
def scence1(screen):
    #background = gameObject.createBgd(tileSheet)
    screen.fill((0,0,0))
    zeldaDialog = Dialog(screen, zeldaPhoto)
    linkDialog = Dialog(screen, linkPhoto)
    unNoDialog = Dialog(screen)

    unNoDialog.message = (
            "???: Excuse me! Sir. ",
            "Princess Zelda would like to have a word with you. ",
            "She is waiting for you in front of the castle. ",
            "Do not make princess waiting for you to long. ",)
    unNoDialog.show = True
    unNoDialog.sndNext()
    unNoDialog.message = (
            "Ok, let me explain the basic control. ",
            "Basicly, there are three keyboard you have to know: ",
            "Escape key: exit from current state (useless in dialog) ",
            "Spacebar  : to advance dialog, to talk, to start the game ",
            "Enter key : mostly work the same as spacebar ",
            "use arrow key to move. ")
    unNoDialog.show = True
    unNoDialog.sndNext()

    linkDialog.message = (
            "Ok! I will be there right away. ",
            "Thank you. ")
    linkDialog.show = True
    linkDialog.sndNext()

    if test.run(screen):
        keepGoing = True
    else:
        keepGoing = False
        return True     #donePlayer = True

    cover = pygame.Surface(screen.get_size())
    cover.fill((0,0,0,0))
    cover = cover.convert()

    alpha = 0

    time = pygame.time.Clock()

    pygame.mixer.music.fadeout(500)

    while keepGoing:
        time.tick(30)

        if alpha >= 255:
            keepGoing = False
        cover.set_alpha(alpha)
        alpha += 5
        screen.blit(cover, (0,0))
        pygame.display.flip()

    return False    #donePlaying = false
开发者ID:Morfyo,项目名称:PYTHON,代码行数:59,代码来源:gameScence.py

示例2: scenceLevel3

# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import message [as 别名]
def scenceLevel3(screen):
    background = gameObject.createBgd(tileSheet)
    screen.blit(background, (0,0))
    zeldaDialog = Dialog(screen, zeldaPhoto)
    linkDialog = Dialog(screen, linkPhoto)

    zeldaDialog.message = (
        "Pretty good job Link! ",
        "Nevertheless, I would like more candies.",
        "Let's head to Candy Castle 1. ")
    zeldaDialog.show = True
    zeldaDialog.sndNext()
    zeldaDialog.message = (
        "As I know from the people around there, ",
        "there are out number of zombies. If you think you ",
        "can't avoide them, you can throw the candy as your ",
        "bullet and they'll out of your way. ",
        "(hit spacebar to throw, you can't throw candy if you ",
        "have 0 candy.) ")
    zeldaDialog.show = True
    zeldaDialog.sndNext()
开发者ID:Morfyo,项目名称:PYTHON,代码行数:23,代码来源:gameScence.py

示例3: scenceLevel2

# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import message [as 别名]
def scenceLevel2(screen):
    background = gameObject.createBgd(tileSheet)
    screen.blit(background, (0,0))
    zeldaDialog = Dialog(screen, zeldaPhoto)
    linkDialog = Dialog(screen, linkPhoto)

    zeldaDialog.message = (
        "Pretty good job Link! ",
        "Nevertheless, I would like more candies.",
        "Let's head to Candy Forest 2. ")
    zeldaDialog.show = True
    zeldaDialog.sndNext()
开发者ID:Morfyo,项目名称:PYTHON,代码行数:14,代码来源:gameScence.py

示例4: conversion

# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import message [as 别名]
    def conversion(self, screen = None):
        if not screen:
            screen = pygame.display.set_mode((640, 480))
        dialog = Dialog(screen,zeldaPhoto)
        if self.conNum == 0:
            linkDialog = Dialog(screen, linkPhoto)
            dialog.message = (
                "Link!!!! ",
                "I miss you very much. ",
                "How have you been? ")
            dialog.show = True
            dialog.sndNext()
            linkDialog.message = (
                "... ",
                "so far so good. ")
            linkDialog.show = True
            linkDialog.sndNext()

            dialog.message = (
                "What's bite you! ",
                "Anyway, I have some mission for you to do. ",
                "I'm sure it is piece of cake for you. ")
            dialog.show = True
            dialog.sndNext()

            linkDialog.message = (
                "??? ",
                "yea? ")
            linkDialog.show = True
            linkDialog.sndNext()

            dialog.message = (
                "Here is the deal. "
                "I want you to bring some candies. ",
                "Oh, anyway, I want a lot of candies. ",
                "Therefore, You have to collect as many candies as possible. ",
                "I love candy very much because it tast extremely woderfull. ",
                "You know what, ... uh...oh, I know that eating candy would ",
                "help my teeth drop easily. Once they're all gone, I have no ",
                "worry about toothache any more. ",
                "Ok, now let's head to Candy Forest and collect them for me. ")
            dialog.show = True
            dialog.sndNext()

            self.conNum += 1
        elif self.conNum == 1:
            dialog.message = (
                "Hello, Link ",
                "How are you doing? ",
                )
            dialog.show = True
            dialog.sndNext()
开发者ID:Morfyo,项目名称:PYTHON,代码行数:54,代码来源:gameObject.py

示例5: mapNumber2

# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import message [as 别名]

#.........这里部分代码省略.........
                (unWalkSurf, (335, 150)),(unWalkSurf1,(535, 150)),(unWalkSurf, (535, 200)),
                (unWalkSurf, (585, 200)),(unWalkSurf2,(432,150)),(unWalkSurf2,(495,150))]
    unWalkLayer = gameObject.Layer()
    unWalkLayer.fillPart(surfList, True, invinsible = True)

    transferLayer = gameObject.Layer()
    transferLayer.transPoint((525, 140))
    transferLayer1 = gameObject.Layer()
    transferLayer1.transPoint((475, 140),(50,20))
    transferLayer2 = gameObject.Layer()
    transferLayer2.transPoint((410, 140),(50,20))
    transRectList = [transferLayer.rect, transferLayer1.rect, transferLayer2.rect]

    transferLayer3 = gameObject.Layer()
    transferLayer3.transPoint((0, 350),(5,300))
    transferLayer4 = gameObject.Layer()
    transferLayer4.transPoint((640, 350),(5,300))

    for element in unWalkLayer.unWalkableList:
        link.unWalkableList.append(element)

    link.unWalkableList.append(princess.rect)

    dialog = Dialog(screen)

    allSprite = pygame.sprite.Group(unWalkLayer, transferLayer, transferLayer1,
            transferLayer2, transferLayer3, transferLayer4, princess,link)

    keepGoing = True
    time = pygame.time.Clock()
    canLeave = False
    screen.blit(background, (0,0))

    while keepGoing:
        time.tick(30)

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                keepGoing = False
                return -1, None

            elif event.type == pygame.KEYDOWN:
                if event.key == pygame.K_ESCAPE:
                    keepGoing = False
                    return -1, None
                elif event.key == pygame.K_SPACE:
                    if link.bigRect.colliderect(princess.rect):
                        if link.dir == "up":
                            princess.face("down")
                        elif link.dir == "down":
                            princess.face("up")
                        if link.dir == "left":
                            princess.face("right")
                        elif link.dir == "right":
                            princess.face("left")

                        allSprite.clear(screen, background)
                        allSprite.update()
                        allSprite.draw(screen)
                        pygame.display.flip()
                        princess.conversion(screen)
                        princess.face("down")
                        canLeave = True

        mousePos = gameObject.mouse_pos()
        pygame.display.set_caption("Mouse Pos: %s" % str(mousePos))

        if link.rect.collidelist(transRectList) != -1:
            keepGoing = False
            return 1, (560, 390)
        elif link.rect.colliderect(transferLayer3.rect):
            if canLeave:
                keepGoing = False
                return 0, None
            link.move("right")
            link.move("right")
            link.moveStep([("right", 10),])
            dialog.message = ("I have to talk with princess ",
                              "before I set out. ")
            dialog.show = True
            dialog.sndNext()
            #link.face("right")
        if link.rect.colliderect(transferLayer4.rect):
            if canLeave:
                keepGoing = False
                return 0, None
            link.move("left")
            link.move("left")
            link.moveStep([("left", 10),])
            dialog.message = ("I have to talk with princess ",
                              "before I set out. ")
            dialog.show = True
            dialog.sndNext()
            #link.face("left")

        allSprite.clear(screen, background)
        allSprite.update()
        allSprite.draw(screen)
        pygame.display.flip()
    return 0, None
开发者ID:Morfyo,项目名称:PYTHON,代码行数:104,代码来源:test.py

示例6: instruction

# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import message [as 别名]
def instruction(score, level):
    pygame.display.set_caption("Instruction")

    background = gameObject.createBgd(tileSheet)
    screen.blit(background,(0,0))

    hero = player.Hero()
    heroSprite = pygame.sprite.Group(hero)

    if level == 3:
        enemy = "sceleton"
    else:
        enemy = "bomb"

    if level == 3:
        tileMaster = pygame.image.load(tileSheet).convert()
        floor = tileMaster.subsurface((200,128), (24,15))
        layer = gameObject.Layer()
        layer.fill(floor)
        sprite = pygame.sprite.Group(layer)
        sprite.update()
        sprite.draw(screen)
        background.blit(screen,(0,0))

    dialog = Dialog(screen, zeldaPhoto)
    if score > 0 and level == 1:
        dialog.message = (
            "Oh dear! ",
            "You can collect only %d candies, but I need at least 700 " % score,
            "candies. ",
            " ",
            "Thank you anyway. ")
        dialog.show = True
        dialog.sndNext()
    elif score > 0 and level == 2:
        dialog.message = (
            "Thank you very much. ",
            "Try to collect more candies please. ",
            "I need at least 350. ")
        dialog.show = True
        dialog.sndNext()
    elif score > 0 and level == 3:
        dialog.message = (
            "Oh dear! ",
            "I really appreciate it. ",
            "However, I need more. ")
        dialog.show = True
        dialog.sndNext()
    pygame.mixer.music.load(insBGM)
    pygame.mixer.music.play(-1)
    insFont = pygame.font.Font(defaultF, 30)
    message = (
        "Zelda Love Candy       Last score: %d" % score,
        "",
        "Your goal is to collect candies ",
        "as many as possible.",
        "Try not hit the %s too much." % enemy,
        "Otherwise, you will die.",
        "",
        "Click or press Space to begin.",
        "Escape to Main Screen",
        "Use arrow key to move.",
        "",
        "Good Luck!")
    textSurfList = []
    for line in message:
        tempText = insFont.render(line, 1, (255,255,0))
        textSurfList.append(tempText)

    time = pygame.time.Clock()
    keepGoing = True

    while keepGoing:
        time.tick(30)

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                donePlaying = True
                keepGoing = False
            elif event.type == pygame.KEYDOWN:
                if event.key == pygame.K_ESCAPE:
                    donePlaying = True
                    keepGoing = False
                elif event.key == pygame.K_SPACE:
                    donePlaying = False
                    keepGoing = False
            elif event.type == pygame.MOUSEBUTTONDOWN:
                donePlaying = False
                keepGoing = False

        heroSprite.clear(screen, background)
        heroSprite.update()
        heroSprite.draw(screen)

        for index in range(len(textSurfList)):
            screen.blit(textSurfList[index], (50, index * 40))

        pygame.display.flip()
    pygame.mixer.music.stop()
    return donePlaying
开发者ID:Morfyo,项目名称:PYTHON,代码行数:102,代码来源:gameScence.py


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