Beispiel #1
0
	def animate_taunt(self, character):
		texts = taunts[None] + taunts.get(character.race.name, [])
		text = random.choice(texts)

		image = draw_speech_bubble(text)
		rect = image.get_rect()
		rect.topleft = character.pos
		rect.top -= rect.height

		sprite = Tile(image, rect, layer=(4,))

		self.sprites.add(sprite)
		self.draw(FPS)
		self.sprites.remove(sprite)
Beispiel #2
0
    def attack(self, attacker, target, damage, messages):
        attacker_position = attacker.grid_pos
        target_position = target.grid_pos
        print "Character at (%d,%d) attacked character at (%d,%d)" % (
            attacker_position[0],
            attacker_position[1],
            target_position[0],
            target_position[1],
        )
        if attacker.mp > 0:
            texts = taunts[None] + taunts.get(attacker.race.name, [])
            text = draw_speech_bubble(random.choice(texts))
            rect = text.get_rect()
            rect.topleft = attacker.pos
            rect.top -= rect.height
            sprite = Tile(text, rect, layer=(4,))
            self.sprites.add(sprite)
            self.draw(FPS)
            self.sprites.remove(sprite)

            self.animate_hit(target, os.path.join(GFXDIR, "sword_hit_small.gif"))
            self.messages.messages.append(" ".join(messages))
            target.take_hit(damage)
            attacker.mp = 0