Advertisement
GraySentinel

Untitled

Apr 16th, 2017
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.68 KB | None | 0 0
  1. #!/usr/bin/env python3
  2.  
  3. import tdl
  4.  
  5. #actual size of the window
  6. SCREEN_WIDTH = 80
  7. SCREEN_HEIGHT = 50
  8.  
  9. LIMIT_FPS = 20  #20 frames-per-second maximum
  10.  
  11. def handle_keys():
  12.     global playerx, playery
  13.  
  14.     #turn-based
  15.     user_input = tdl.event.key_wait()
  16.  
  17.     if user_input.key == 'ESCAPE':
  18.         return True  #exit game
  19.  
  20. tdl.set_font('arial10x10.png', greyscale=True, altLayout=True)
  21.  
  22. console = tdl.init(SCREEN_WIDTH, SCREEN_HEIGHT, title="Roguelike", fullscreen=False)
  23.  
  24. tdl.setFPS(LIMIT_FPS)
  25.  
  26. while not tdl.event.is_window_closed():
  27.  
  28.     tdl.flush()
  29.    
  30.     #handle keys and exit game if needed
  31.     exit_game = handle_keys()
  32.     if exit_game:
  33.         break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement