-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmars_rogue-06.py
66 lines (51 loc) · 2.06 KB
/
mars_rogue-06.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env python3
import sys
sys.path.append('C:\\Users\\aavon\\AppData\\Local\\Programs\\Python\\Python310\\Lib')
sys.path.append('C:\\Users\\aavon\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages')
import tcod
## pip install -r requirements.txt
from engine import Engine
from entity import * # including globals object
#from actions import EscapeAction, MovementAction
#from game_map import GameMap
from input_handler import EventHandler
from procgen import generate_dungeon
# -------------------
def main() -> None:
screen_width = globals.screen_width
screen_height= globals.screen_height
map_width = 80
map_height= 45
tileset = tcod.tileset.load_tilesheet(
"16x16_ascii-charset.png", 16, 16, tcod.tileset.CHARMAP_CP437
)
event_handler = EventHandler()
player = Entity(x=int(screen_width/2), y=int(screen_height/2), char="@", color=(255,255,255))
# npc = Entity(x=int(screen_width/2 - 5), y=int(screen_height/2), char="@", color=(255,255,0))
# entities = {npc, player}
# game_map = GameMap(map_width, map_height)
game_map = generate_dungeon(
max_rooms=globals.max_rooms,
room_min_size=globals.room_min_size,
room_max_size=globals.room_max_size,
map_width=map_width,
map_height=map_height,
player=player
)
engine = Engine(event_handler=event_handler, game_map=game_map, player=player)
with tcod.context.new_terminal(
screen_width, screen_height,
tileset=tileset,
title = "Mars Rogue", vsync=True,
) as context:
root_console = tcod.Console(screen_width, screen_height, order="F")
while True:
engine.render(console=root_console, context=context)
#context.present(root_console) # Important if you want things to display at all!
events = tcod.event.wait()
engine.handle_events(events)
#root_console.clear()
# ===========================
if __name__ == "__main__":
main()
##