GameResources.py 418 B

1234567891011121314
  1. import os, pygame
  2. def load_image(name):
  3. """A better load of images."""
  4. fullname = os.path.join("images", name)
  5. try:
  6. image = pygame.image.load(fullname)
  7. if image.get_alpha() == None:
  8. image = image.convert()
  9. else:
  10. image = image.convert_alpha()
  11. except pygame.error:
  12. print("Oops! Could not load image:", fullname)
  13. return image, image.get_rect()