illume avatar illume committed 51bc962

can draw small too

Comments (0)

Files changed (3)

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()

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:

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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.