1 # Player and Player-like objects
3 from erdslangetjie.data import load_image
6 class PlayerSprite(object):
12 def move(self, direction):
13 self.pos = (self.pos[0] + direction[0], self.pos[1] + direction[1])
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)
24 class ThePlayer(PlayerSprite):
27 super(ThePlayer, self).__init__()
28 self.sprite = load_image('sprites/player.png')
31 class Nemesis(PlayerSprite):
34 super(ThePlayer, self).__init__()
35 self.sprite = load_image('sprites/nemesis.png')