コード例 #1
0
def init():
    for i in range(num_bac):
        bacteria.add(
            VirusNode(
                (random.randint(50, width - 50), random.randint(
                    50, height - 50)), split_time))
    for i in range(num_docs):
        doctors.add(
            Doctor(
                (random.randint(50,
                                width - 50), random.randint(50, height - 50))))
コード例 #2
0
def init():
    global round_over
    bacteria.empty()
    doctors.empty()
    round_over = False
    for i in range(bac_num):
        bacteria.add(
            VirusNode(
                (random.randint(50, width - 50), random.randint(
                    50, height - 50)), split_time))
    for i in range(doc_num):
        doctors.add(
            Doctor(
                (random.randint(50,
                                width - 50), random.randint(50, height - 50))))
コード例 #3
0
def main():
    # NEW FOLLOWS *********************************
    bacteria.add(VirusNode((random.randint(50, width - 50), random.randint(50, height - 50)), split_time))
    doctors.add(Doctor((random.randint(50, width - 50), random.randint(50, height - 50))))
    # NEW ABOVE ******************************************************************
    while not done:
        clock.tick(60)
        process_events()
    # NEW FOLLOWS *************************************************************
        doctors.update()
        bacteria.update()
    # NEW ABOVE ***************************************************************
        screen.fill(color)
        doctors.draw(screen)
        bacteria.draw(screen)
        pygame.display.flip()