Tweak window size
[erdslangetjie.git] / erdslangetjie / player.py
1 # Player and Player-like objects
2
3 from erdslangetjie.data import load_image
4
5
6 class PlayerSprite(object):
7
8     def __init__(self):
9         self.pos = (0, 0)
10         self.sprite = None
11
12     def move(self, direction):
13         self.pos = (self.pos[0] + direction[0], self.pos[1] + direction[1])
14
15     def can_move(self, direction, level):
16         '''Check if we can move in the given direction'''
17         cand_pos = (self.pos[0] + direction[0], self.pos[1] + direction[1])
18         return not level.blocked(cand_pos)
19
20     def get_image(self):
21         return self.sprite
22
23
24 class ThePlayer(PlayerSprite):
25
26     def __init__(self):
27         super(ThePlayer, self).__init__()
28         self.sprite = load_image('sprites/player.png')
29
30
31 class Nemesis(PlayerSprite):
32
33     def __init__(self):
34         super(ThePlayer, self).__init__()
35         self.sprite = load_image('sprites/nemesis.png')