def __init__(self, duck, screen):
     pygame.sprite.Sprite.__init__(self)
     self.screen = screen
     s_width, s_height = settings.getint("Graphics", "width"), settings.getint("Graphics", "height")
     self.duck = duck
     self.forward = resource.load_image("duck.png")
     self.backward = resource.load_image("duck2.png")
     self.image = self.forward
     d_width, d_height = self.image.get_size()
     left = random.randint(0, s_width - d_width - 1)
     top = random.randint(0, s_height - d_height - 1)
     self.rect = pygame.rect.Rect(left, top, d_width, d_height)
     self.speed = duck.productivity * 5
     self.set_target()
     debug("Created duck sprite at %d,%d" % (left, top))
	def __init__(self, pygame_events, game_actions=('left', 'right'), game_events=('jump',)):
		EntityInput.__init__(self)

		self.state = {}
		for action in game_actions:
			self.state[action] = False

		self.action_keys = {}
		self.event_keys = {}
		for action in game_actions:
			self.action_keys[settings.getint('Keys', action)] = action
		for event in game_events:
			self.event_keys[settings.getint('Keys', event)] = event

		debug('key mapping = %s, %s', self.action_keys, self.event_keys)
		pygame_events.subscribe(self.process_input)
	def __init__(self):
		Publisher.__init__(self)
		self.source = pygame.time.Clock()
		self.max_framerate = settings.getint('Graphics', 'framerate')