Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- import tdl
- #actual size of the window
- SCREEN_WIDTH = 80
- SCREEN_HEIGHT = 50
- LIMIT_FPS = 20 #20 frames-per-second maximum
- def handle_keys():
- global playerx, playery
- #turn-based
- user_input = tdl.event.key_wait()
- if user_input.key == 'ESCAPE':
- return True #exit game
- tdl.set_font('arial10x10.png', greyscale=True, altLayout=True)
- console = tdl.init(SCREEN_WIDTH, SCREEN_HEIGHT, title="Roguelike", fullscreen=False)
- tdl.setFPS(LIMIT_FPS)
- while not tdl.event.is_window_closed():
- tdl.flush()
- #handle keys and exit game if needed
- exit_game = handle_keys()
- if exit_game:
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement