Exemplo n.º 1
0
            if event.type in [pygame.MOUSEBUTTONDOWN, pygame.MOUSEMOTION]:
                for robot in robots:
                    robot.event_response(event)
                ball.event_response(event)

        display.fill((0, 86, 27))

        # for better code readability rend is pygame.font.Font.render
        score_image = font.render('{0} : {1}'.format(env.teamAscore,
                                                     env.teamBscore),
                                  True, (255, 255, 255))
        textpos = score_image.get_rect(centerx=WIDTH/2,
                                       centery=HEIGHT+TABLE_HEIGHT/2)
        display.blit(score_image, textpos)

        env.draw_field()
        for robot in robots:
            robot.sense()
            robot.act_handler(robot)

            robot.update()
            robot.draw()

        ball.stay_in()
        ball.draw()

        for prop in props:
            prop.draw()

        b2world.Step(TIME_STEP, 10, 10)
        pygame.display.flip()