|
@@ 779-802 (lines=24) @@
|
| 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. |
| 782 |
|
# during the player movement, only the @ is redrawn. |
| 783 |
|
# the rest impacts only the background color |
| 784 |
|
# draw the help text & player @ |
| 785 |
|
libtcod.console_clear(sample_console) |
| 786 |
|
libtcod.console_set_default_foreground(sample_console, libtcod.white) |
| 787 |
|
libtcod.console_put_char(sample_console, path_dx, path_dy, '+', |
| 788 |
|
libtcod.BKGND_NONE) |
| 789 |
|
libtcod.console_put_char(sample_console, path_px, path_py, '@', |
| 790 |
|
libtcod.BKGND_NONE) |
| 791 |
|
libtcod.console_print(sample_console, 1, 1, |
| 792 |
|
"IJKL / mouse :\nmove destination\nTAB : A*/dijkstra") |
| 793 |
|
libtcod.console_print(sample_console, 1, 4, |
| 794 |
|
"Using : A*") |
| 795 |
|
# draw windows |
| 796 |
|
for y in range(SAMPLE_SCREEN_HEIGHT): |
| 797 |
|
for x in range(SAMPLE_SCREEN_WIDTH): |
| 798 |
|
if smap[y][x] == '=': |
| 799 |
|
libtcod.console_put_char(sample_console, x, y, |
| 800 |
|
libtcod.CHAR_DHLINE, |
| 801 |
|
libtcod.BKGND_NONE) |
| 802 |
|
path_recalculate = True |
| 803 |
|
if path_recalculate: |
| 804 |
|
if path_using_astar : |
| 805 |
|
libtcod.path_compute(path, path_px, path_py, path_dx, path_dy) |
|
@@ 585-605 (lines=21) @@
|
| 582 |
|
torchs = 'on ' |
| 583 |
|
if fov_light_walls : |
| 584 |
|
lights='on ' |
| 585 |
|
if first: |
| 586 |
|
libtcod.sys_set_fps(30) |
| 587 |
|
# we draw the foreground only the first time. |
| 588 |
|
# during the player movement, only the @ is redrawn. |
| 589 |
|
# the rest impacts only the background color |
| 590 |
|
# draw the help text & player @ |
| 591 |
|
libtcod.console_clear(sample_console) |
| 592 |
|
libtcod.console_set_default_foreground(sample_console, libtcod.white) |
| 593 |
|
libtcod.console_print(sample_console, 1, 1, |
| 594 |
|
"IJKL : move around\nT : torch fx %s\nW : light walls %s\n+-: algo %s" % |
| 595 |
|
(torchs,lights,fov_algo_names[fov_algo_num])) |
| 596 |
|
libtcod.console_set_default_foreground(sample_console, libtcod.black) |
| 597 |
|
libtcod.console_put_char(sample_console, fov_px, fov_py, '@', |
| 598 |
|
libtcod.BKGND_NONE) |
| 599 |
|
# draw windows |
| 600 |
|
for y in range(SAMPLE_SCREEN_HEIGHT): |
| 601 |
|
for x in range(SAMPLE_SCREEN_WIDTH): |
| 602 |
|
if smap[y][x] == '=': |
| 603 |
|
libtcod.console_put_char(sample_console, x, y, |
| 604 |
|
libtcod.CHAR_DHLINE, |
| 605 |
|
libtcod.BKGND_NONE) |
| 606 |
|
if fov_recompute: |
| 607 |
|
fov_recompute = False |
| 608 |
|
if fov_torch: |