node-message.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:wargame 作者: maximinus 项目源码 文件源码
def game():
    resources = os.path.join(os.getcwd(), '../')
    controller = wargame.engine.init(resources)

    # this time, we want 1 node to control 2 other nodes

    # we need 2 images to display mouse over and mouse not over
    red = Resources.colour_surface(128, 128, (255, 0, 0))
    blue = Resources.colour_surface(128, 128, (0, 0, 255))
    green = Resources.colour_surface(128, 128, (0, 255, 0))

    # we need a node
    sender = NodeTransmit(green, blue, pygame.Rect(256, 173, 128, 128))
    receive1 = NodeReceive(blue, red, pygame.Rect(64, 176, 128, 128), sender.message_id)
    receive2 = NodeReceive(blue, red, pygame.Rect(448, 176, 128, 128), sender.message_id)

    # add the nodes to a SCENE
    scene = Scene([sender, receive1, receive2])
    # I add the scene to the ENGINE
    controller.add_scene('start', scene)
    # I tell the engine what scene to start and run the controller
    controller.run('start')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号