home · contact · privacy
Add basic multiplayer roguelike chat example.
[plomrogue2-experiments] / new2 / plomrogue / mapping.py
diff --git a/new2/plomrogue/mapping.py b/new2/plomrogue/mapping.py
new file mode 100644 (file)
index 0000000..1847f69
--- /dev/null
@@ -0,0 +1,14 @@
+import collections
+
+
+
+class YX(collections.namedtuple('YX', ('y', 'x'))):
+
+    def __add__(self, other):
+        return YX(self.y + other.y, self.x + other.x)
+
+    def __sub__(self, other):
+        return YX(self.y - other.y, self.x - other.x)
+
+    def __str__(self):
+        return 'Y:%s,X:%s' % (self.y, self.x)