# # Boss.py # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # Copyright # Author: Salvatore S. Gionfriddo # Contributors: # Created: 2007.11.03 # Last Modified: # import pygame from Enemy import Enemy class Boss(Enemy): def __init__(self, name = "Boss"): self.name = name Enemy.__init__(self) def draw(self, surface): """ THIS IS GIANT PIECE OF CRAP. PLEASE DESTROY THE HAXXXXX """ amount = (self.health * 28) / self.MAX_HEALTH # draw character r = Enemy.draw(self, surface) # draw bar backgroundBar = pygame.Surface((30,11)) backgroundBar = backgroundBar.convert() backgroundBar.fill((0,0,0)) bar = pygame.Surface((amount, 9)) bar = bar.convert() bar.fill((0,255,0)) emptyBar = pygame.Surface((28 - amount,9)) emptyBar = emptyBar.convert() emptyBar.fill((255,0,0)) backgroundBar.blit(bar,(1,1)) backgroundBar.blit(emptyBar,(1 + amount, 1)) backgroundBar.set_alpha(200) r2 = surface.blit(backgroundBar, (self.rect.left, self.rect.top - 10)) # draw name font = pygame.font.Font(None, 14) rfont = font.render(self.name,1,(0,0,0)) r3 = surface.blit(rfont, (self.rect.left+2, self.rect.top - 9)) #make rect lists rectlist = r[:] r = [] for rc in rectlist: r.append(rc.union(r2).union(r3)) return r