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')
评论列表
文章目录