import pygame, spriteloader, inanimate, display, inventory

class Item(inanimate.inanimate):
    "Item"
    def __init__(self,location, imagefile, name ):
        self.image = pygame.image.load(imagefile).convert()
        self.image.set_colorkey((0,0,0))
        self.location = location
        self.name = name
        self.found = False
        self.inventory = inventory
    def colliderect(self, other):
        colliding = self.location.colliderect(other) and not self.found
        if colliding:
            self.found = True
        return colliding
    def is_solid(self):
        return False
    def draw(self,screen, screen_rect):
        if display.is_on_screen(self.location,screen_rect) and not self.found:
            screen.blit(self.image, display.abs_to_screen(self.location,screen_rect))
        

