Exemple #1
0
    for event in pygame.event.get(): # User did something

        if event.type == pygame.QUIT: # If user clicked close
            done = True # Flag that we are done so we exit this loop

    if counter == 0:
        # only update once per second (n ticks)
        for drone in drones:
            # give the drones the new map (or maybe don't) and then update
            # the map based on the drones' movement
            drone.setMap(data)
            # move 'em
            direction = drone.nextStep()

	    # 
            drone.setLocation(drone.x + direction[0], drone.y + direction[1])


            # maybe don't update map based on drone (denied comms)
            # TODO this *should* be simultaneous
            data = drone.update()

        data.update() # update the map (steps all of the diff. eqs. forward one)
        view.update(data, drones)

    counter = (counter+1) % (fps/10)

    clock.tick(fps) # max fps

pygame.quit()
Exemple #2
0
    for event in pygame.event.get():  # User did something

        if event.type == pygame.QUIT:  # If user clicked close
            done = True  # Flag that we are done so we exit this loop

    if counter == 0:
        # only update once per second (n ticks)
        for drone in drones:
            # give the drones the new map (or maybe don't) and then update
            # the map based on the drones' movement
            drone.setMap(data)
            # move 'em
            direction = drone.nextStep()

            #
            drone.setLocation(drone.x + direction[0], drone.y + direction[1])

            # maybe don't update map based on drone (denied comms)
            # TODO this *should* be simultaneous
            data = drone.update()

        data.update(
        )  # update the map (steps all of the diff. eqs. forward one)
        view.update(data, drones)

    counter = (counter + 1) % (fps / 10)

    clock.tick(fps)  # max fps

pygame.quit()