Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 56 lines (52 sloc) 1.405 kb
f7e934da »
2008-07-30 Basic game with level border and arrow key movement.
1 from curses import *
2
3 # format:
4 # key code: (dx, dy)
5 # where dx and dy are the difference in x and y coordinate
1506f791 »
2008-07-31 Refactoring.
6 KEY_MAPPING = {
c7d20470 »
2008-07-31 Added history tracking. Changed from using a sub window to just drawi…
7 'q': 'quit',
b7db4bbc »
2008-08-04 Split entity.py into multiple files.
8 'r': 'restart',
c7d20470 »
2008-07-31 Added history tracking. Changed from using a sub window to just drawi…
9 'u': 'undo',
543f5ce1 »
2008-08-03 Added - key to undo, changed display of border, added some ideas.
10 '-': 'undo',
7fc674ea »
2008-08-03 Added display of bumping into things.
11 KEY_DC: 'undo',
12 KEY_BACKSPACE: 'undo',
1e190085 »
2008-08-01 Added hero shield.
13 KEY_UP: ('move', (0, -1)),
14 KEY_DOWN: ('move', (0, 1)),
15 KEY_LEFT: ('move', (-1, 0)),
16 KEY_RIGHT: ('move', (1, 0)),
5042628c »
2008-08-04 Refactored display so every call doesn't require a world argument. At…
17 ' ': 'shield', # dead-key for shield
cb175c7c »
2008-08-02 Added key bindings for numpad. Removed some extraneous log messages.
18
19 # dvorak nethack-style bindings
1e190085 »
2008-08-01 Added hero shield.
20 't': ('move', (0, -1)),
21 'h': ('move', (0, 1)),
22 'd': ('move', (-1, 0)),
23 'n': ('move', (1, 0)),
24 'f': ('move', (-1, -1)),
25 'g': ('move', (1, -1)),
26 'b': ('move', (-1, 1)),
27 'm': ('move', (1, 1)),
28 'v': ('move', (0, 0)),
29 'T': ('shield', (0, -1)),
30 'H': ('shield', (0, 1)),
31 'D': ('shield', (-1, 0)),
32 'N': ('shield', (1, 0)),
33 'F': ('shield', (-1, -1)),
34 'G': ('shield', (1, -1)),
35 'B': ('shield', (-1, 1)),
36 'M': ('shield', (1, 1)),
cb175c7c »
2008-08-02 Added key bindings for numpad. Removed some extraneous log messages.
37
38 # numpad bindings
39 '8': ('move', (0, -1)),
40 '2': ('move', (0, 1)),
41 '4': ('move', (-1, 0)),
42 '6': ('move', (1, 0)),
43 '7': ('move', (-1, -1)),
44 '9': ('move', (1, -1)),
45 '1': ('move', (-1, 1)),
46 '3': ('move', (1, 1)),
47 '5': ('move', (0, 0)),
543f5ce1 »
2008-08-03 Added - key to undo, changed display of border, added some ideas.
48 '0': ('shield', (0, 0)),
5042628c »
2008-08-04 Refactored display so every call doesn't require a world argument. At…
49 '+': 'shield', # dead-key for shield
f7e934da »
2008-07-30 Basic game with level border and arrow key movement.
50 }
1506f791 »
2008-07-31 Refactoring.
51 for key, value in KEY_MAPPING.items():
f7e934da »
2008-07-30 Basic game with level border and arrow key movement.
52 try:
1506f791 »
2008-07-31 Refactoring.
53 KEY_MAPPING[ord(key)] = value
f7e934da »
2008-07-30 Basic game with level border and arrow key movement.
54 except TypeError:
55 pass
Something went wrong with that request. Please try again.