Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
__pycache__
.vscode
21 changes: 21 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[[source]]

url = "https://github.com/trprado/roguelike_tutorial_revised_tdl"
verify_ssl = true
name = "roguelike tutorial revised with tdl"


[dev-packages]

pylint = "*"


[packages]

tdl = "*"



[requires]

python_version = "3.6"
17 changes: 9 additions & 8 deletions engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ def main():
make_map(game_map)

while not tdl.event.is_window_closed():
user_input = None

render_all(con, entities, game_map, root_console, screen_width, screen_height, colors)
tdl.flush()

Expand All @@ -39,8 +41,8 @@ def main():
if event.type == 'KEYDOWN':
user_input = event
break
else:
user_input = None
else:
user_input = None

if not user_input:
continue
Expand All @@ -53,14 +55,13 @@ def main():

if move:
dx, dy = move

if game_map.walkable[player.x + dx, player.y + dy]:
player.move(dx, dy)

if exit:
return True

if fullscreen:
elif exit:
if tdl.get_fullscreen():
tdl.set_fullscreen(False)
break
elif fullscreen:
tdl.set_fullscreen(not tdl.get_fullscreen())


Expand Down
2 changes: 1 addition & 1 deletion input_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def handle_keys(user_input):
elif user_input.key == 'RIGHT':
return {'move': (1, 0)}

if user_input.key == 'ENTER' and user_input.alt:
if user_input.key == 'ENTER' and user_input.control:
# Alt+Enter: toggle full screen
return {'fullscreen': True}
elif user_input.key == 'ESCAPE':
Expand Down