From: Neil Date: Mon, 15 Apr 2013 10:56:24 +0000 (+0200) Subject: add basic player sprites X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=191d328780140fad352f168ecb03069f10b4459b;p=erdslangetjie.git add basic player sprites --- diff --git a/erdslangetjie/player.py b/erdslangetjie/player.py new file mode 100644 index 0000000..6fc26e8 --- /dev/null +++ b/erdslangetjie/player.py @@ -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')