Exemplo n.º 1
0
 def drawBackground(self):
   background_image = media.get("cave_background.png")
   result = pygame.Surface(self.getPixelSize())
   for y in range( int(math.ceil(float(result.get_height()) / background_image.get_height())) ):
     for x in range( int(math.ceil(float(result.get_width()) / background_image.get_width())) ):
       result.blit(background_image, (x*background_image.get_width(), y*background_image.get_height()))
   return result
Exemplo n.º 2
0
 def __init__(self, width=80, height=160, ores_file="../ores_test.yaml"):
   # Various Variables
   self.width = width
   self.height = height
   self.tile_size = 16
   self.ores_file = ores_file
   self.ores = Ores(self.ores_file)
   # Cave generation
   self.regenerateCave()
   # Surfaces
   self.dirt_image = media.get("dirt.png")
   self.surface = pygame.Surface(self.getPixelSize())
   self.cave_surface = pygame.Surface(self.getPixelSize())
   self.background_surface = self.drawBackground()
   self.redrawSurface()
Exemplo n.º 3
0
 def load_level(self, level_name):
   # Convert the first layer to make it faster to blit!
   self.layer0 = media.get("levels/{}/layer0.png".format(level_name)).convert()
   self.layer1 = media.get("levels/{}/layer1.png".format(level_name)).convert_alpha()
Exemplo n.º 4
0
 def __init__(self, window):
   self.window = window
   #DELETEME---
   self.image = media.get("test.png").convert()
Exemplo n.º 5
0
 def generateOreSurfs(self):
   ore_image = media.get("ore.png")
   for name in self.ores_dict:
     new_ore = ore_image.copy()
     new_ore.fill(getRandomColor(), None, pygame.BLEND_RGBA_MULT)
     self.ores_dict[name]['image'] = new_ore