add basic player sprites
authorNeil <neil@dip.sun.ac.za>
Mon, 15 Apr 2013 10:56:24 +0000 (12:56 +0200)
committerNeil <neil@dip.sun.ac.za>
Mon, 15 Apr 2013 10:56:24 +0000 (12:56 +0200)
erdslangetjie/player.py [new file with mode: 0644]

diff --git a/erdslangetjie/player.py b/erdslangetjie/player.py
new file mode 100644 (file)
index 0000000..6fc26e8
--- /dev/null
@@ -0,0 +1,30 @@
+# Player and Player-like objects
+
+from erdslangetjie.data import load_image
+
+
+class PlayerSprite(object):
+
+    def __init__(self):
+        self.pos = (0, 0)
+        self.sprite = None
+
+    def move(self, direction):
+        self.pos = (self.pos[0] + direction[0], self.pos[1] + direction[1])
+
+    def get_image(self):
+        return self.sprite
+
+
+class ThePlayer(PlayerSprite):
+
+    def __init__(self):
+        super(ThePlayer, self).__init__()
+        self.sprite = load_image('sprites/player.png')
+
+
+class Nemesis(PlayerSprite):
+
+    def __init__(self):
+        super(ThePlayer, self).__init__()
+        self.sprite = load_image('sprites/nemesis.png')