Example #1
0
 def __init__(self, health):
     pygame.sprite.Sprite.__init__(self)  # call Sprite initializer
     self.top = health.get_size().bottom
     self.rect = pygame.Rect(self.offsetx, self.offset + self.top, 5, 110)  ###changeee
     self.image = pygame.Surface((self.width, 110))
     globalvars.normalize_img(self.image)
     self.healthobject = health
     self.last_health = globalvars.max_health
     pygame.draw.rect(self.image, (128, 128, 128), pygame.Rect(0, 0, self.width, self.last_health))
Example #2
0
 def __init__(self, health):
     pygame.sprite.Sprite.__init__(self)  #call Sprite initializer
     self.top = health.get_size().bottom
     self.rect = pygame.Rect(self.offsetx, self.offset + self.top, 5,
                             110)  ###changeee
     self.image = pygame.Surface((self.width, 110))
     globalvars.normalize_img(self.image)
     self.healthobject = health
     self.last_health = globalvars.max_health
     pygame.draw.rect(self.image, (128, 128, 128),
                      pygame.Rect(0, 0, self.width, self.last_health))
Example #3
0
def quarter(image, size):
    pieces = []
    imgrect = image.get_rect()
    imgrect.width = imgrect.width / size
    imgrect.height = imgrect.height / size
    for x in range(size):
        for y in range(size):
            imgrect.left = imgrect.width * (-x)
            imgrect.top = imgrect.height * (-y)
            img = pygame.Surface(imgrect.size)
            globalvars.normalize_img(img)
            img.blit(image, imgrect)
            pieces.append(img)
    return pieces
Example #4
0
def quarter(image, size):
    pieces = []
    imgrect = image.get_rect()
    imgrect.width = imgrect.width / size
    imgrect.height = imgrect.height / size
    for x in range(size):
        for y in range(size):
            imgrect.left = imgrect.width * (-x)
            imgrect.top = imgrect.height * (-y)
            img = pygame.Surface(imgrect.size)
            globalvars.normalize_img(img)
            img.blit(image, imgrect)
            pieces.append(img)
    return pieces
Example #5
0
 def __init__(self):
     pygame.sprite.Sprite.__init__(self)  # call Sprite initializer
     self.font = pygame.font.Font(globalvars.defaultfont, globalvars.points_text_size)
     self.rect = pygame.Rect(globalvars.points_x, globalvars.points_y, 10, 10)  ###changee
     self.textimg = self.font.render(self.pointstr, 0, (128, 128, 128))
     self.textrect = self.textimg.get_rect()
     self.pointsimg = self.font.render(str(self.total_points), 0, (128, 128, 128))
     self.pointsrect = self.pointsimg.get_rect()
     self.pointsrect.move_ip(0, self.textrect.height)
     self.image = pygame.Surface((self.textrect.width, self.pointsrect.height + self.textrect.height))
     globalvars.normalize_img(self.image)
     # self.image.set_alpha(100)
     pygame.Surface.blit(self.image, self.textimg, self.textrect)
     pygame.Surface.blit(self.image, self.pointsimg, self.pointsrect)
     temp = 1
Example #6
0
 def __init__(self, health, objabove):
     print "lives added"
     self.player = health.a
     self.h = health
     print "player is: %s" % self.player
     self.lastlife = -100
     pygame.sprite.Sprite.__init__(self)  # call Sprite initializer
     self.top = objabove.rect.bottom + 5
     self.rect = pygame.Rect(self.offsetx, self.offset + self.top, self.left, self.length)  ###changeee
     self.image = pygame.Surface((self.width, 200))
     globalvars.normalize_img(self.image)
     self.image.blit(globalvars.screen, self.image.get_rect())
     self.playerimage = pygame.transform.scale(globalvars.playership[0], self.size)
     self.playerimage.set_colorkey(globalvars.bgcolor, pygame.RLEACCEL)
     self.playerrect = self.playerimage.get_rect()
     self.update()
Example #7
0
 def __init__(self, health, objabove):
     print "lives added"
     self.player = health.a
     self.h = health
     print "player is: %s" % self.player
     self.lastlife = -100
     pygame.sprite.Sprite.__init__(self)  #call Sprite initializer
     self.top = objabove.rect.bottom + 5
     self.rect = pygame.Rect(self.offsetx, self.offset + self.top,
                             self.left, self.length)  ###changeee
     self.image = pygame.Surface((self.width, 200))
     globalvars.normalize_img(self.image)
     self.image.blit(globalvars.screen, self.image.get_rect())
     self.playerimage = pygame.transform.scale(globalvars.playership[0],
                                               self.size)
     self.playerimage.set_colorkey(globalvars.bgcolor, pygame.RLEACCEL)
     self.playerrect = self.playerimage.get_rect()
     self.update()
Example #8
0
 def __init__(self):
     pygame.sprite.Sprite.__init__(self)  #call Sprite initializer
     self.font = pygame.font.Font(globalvars.defaultfont,
                                  globalvars.points_text_size)
     self.rect = pygame.Rect(globalvars.points_x, globalvars.points_y, 10,
                             10)  ###changee
     self.textimg = self.font.render(self.pointstr, 0, (128, 128, 128))
     self.textrect = self.textimg.get_rect()
     self.pointsimg = self.font.render(str(self.total_points), 0,
                                       (128, 128, 128))
     self.pointsrect = self.pointsimg.get_rect()
     self.pointsrect.move_ip(0, self.textrect.height)
     self.image = pygame.Surface(
         (self.textrect.width,
          self.pointsrect.height + self.textrect.height))
     globalvars.normalize_img(self.image)
     #self.image.set_alpha(100)
     pygame.Surface.blit(self.image, self.textimg, self.textrect)
     pygame.Surface.blit(self.image, self.pointsimg, self.pointsrect)
     temp = 1