@@ 766-778 (lines=13) @@ | ||
763 | ] |
|
764 | TORCH_RADIUS = 10.0 |
|
765 | SQUARED_TORCH_RADIUS = TORCH_RADIUS * TORCH_RADIUS |
|
766 | if not path_init: |
|
767 | path_init = True |
|
768 | path_map = libtcod.map_new(SAMPLE_SCREEN_WIDTH, SAMPLE_SCREEN_HEIGHT) |
|
769 | for y in range(SAMPLE_SCREEN_HEIGHT): |
|
770 | for x in range(SAMPLE_SCREEN_WIDTH): |
|
771 | if smap[y][x] == ' ': |
|
772 | # ground |
|
773 | libtcod.map_set_properties(path_map, x, y, True, True) |
|
774 | elif smap[y][x] == '=': |
|
775 | # window |
|
776 | libtcod.map_set_properties(path_map, x, y, True, False) |
|
777 | path = libtcod.path_new_using_map(path_map) |
|
778 | path_dijk = libtcod.dijkstra_new(path_map) |
|
779 | if first: |
|
780 | libtcod.sys_set_fps(30) |
|
781 | # we draw the foreground only the first time. |
|
@@ 566-578 (lines=13) @@ | ||
563 | dx = 0.0 |
|
564 | dy = 0.0 |
|
565 | di = 0.0 |
|
566 | if not fov_init: |
|
567 | fov_init = True |
|
568 | fov_map = libtcod.map_new(SAMPLE_SCREEN_WIDTH, SAMPLE_SCREEN_HEIGHT) |
|
569 | for y in range(SAMPLE_SCREEN_HEIGHT): |
|
570 | for x in range(SAMPLE_SCREEN_WIDTH): |
|
571 | if smap[y][x] == ' ': |
|
572 | # ground |
|
573 | libtcod.map_set_properties(fov_map, x, y, True, True) |
|
574 | elif smap[y][x] == '=': |
|
575 | # window |
|
576 | libtcod.map_set_properties(fov_map, x, y, True, False) |
|
577 | # 1d noise for the torch flickering |
|
578 | fov_noise = libtcod.noise_new(1, 1.0, 1.0) |
|
579 | torchs = 'off' |
|
580 | lights = 'off' |
|
581 | if fov_torch: |