Commits

illume  committed 51bc962

can draw small too

  • Participants
  • Parent commits ec1b1a4

Comments (0)

Files changed (3)

File alchemymadness/blocks.py

     @property
     def image(self):
         if self.changed:
-            self._image = resources.block.copy()
+            if self.small:
+                self._image = resources.sblock.copy()
+            else:
+                self._image = resources.block.copy()
             self._image.fill(self._color, special_flags=pygame.locals.BLEND_RGBA_MULT)
         return self._image
 
     def on_moved(self):
         i = 0
         for b, pos in zip(self.blocks, self.grid_positions):
-            #print "on_moved {}".format(i)
+            #print "on_moved {} {}".format(i, pos)
             b.grid_pos(pos, self.parent.rect)
             i += 1
 
         super(Grid, self).__init__()
         self.small = small
 
+        self.GRID_SIZE_W = GRID_SIZE_W
+        self.GRID_SIZE_H = GRID_SIZE_H
+
         if self.small:
-            self.GRID_SIZE_W = SGRID_SIZE_W
-            self.GRID_SIZE_H = SGRID_SIZE_H
-            self.rect = pygame.Rect(30, 20, SGRID_SIZE_W * SBLOCK_W, SGRID_SIZE_H * SBLOCK_H)
+            self.rect = pygame.Rect(30, 20, GRID_SIZE_W * SBLOCK_W, GRID_SIZE_H * SBLOCK_H)
         else:
-            self.GRID_SIZE_W = GRID_SIZE_W
-            self.GRID_SIZE_H = GRID_SIZE_H
-
             self.rect = pygame.Rect(30, 20, GRID_SIZE_W * BLOCK_W, GRID_SIZE_H * BLOCK_H)
 
         self.restart()

File alchemymadness/main.py

     # Initialise level
     pot = potion.Potion()
     pot.set_formula(3, 5, 3)
-    grd = blocks.Grid(small = False)
+    grd = blocks.Grid(small = True)
     blks = blocks.Blocks(grd)
     sprites = pygame.sprite.LayeredDirty(pot)
     for b in blks.blocks:

File alchemymadness/resources.py

 
 background = None
 block = None
+sblock = None
 
 def init():
-    global background, block
+    global background, block, sblock
     background = pygame.image.load(skelutil.data_dir("bg.png")).convert_alpha()
     block = pygame.image.load(skelutil.data_dir("block.png")).convert_alpha()
+    sblock = pygame.transform.scale(block, (int(block.get_rect()[2]/2), int(block.get_rect()[3])))
+    print block, sblock