Commits

illume committed 47e81b2

Adding comments and some TODO in methods.

Comments (0)

Files changed (1)

alchemymadness/blocks.py

 BLOCK_W = 30
 BLOCK_H = 30
 
+# small block size.
 SBLOCK_W = BLOCK_W / 2
 SBLOCK_H = BLOCK_H / 2
 
 class Block(DirtySprite):
+    """ A single block.
+    """
+
     changed = False
 
     def __init__(self, color, small, *groups):
+        """
+            color - (r,g,b) tuple.
+            small - True if we are to be drawn small.
+        """
         super(Block, self).__init__(*groups)
 
         self.small = small
     """ contains 3 Block() instances.
     """
     def __init__(self, parent):
+        """ parent - a Grid instance.
+        """
         super(Blocks, self).__init__()
 
         self.parent = parent
         self.on_moved()
 
     def on_moved(self):
+        """ called when we have moved.
+        """
         i = 0
         for b, pos in zip(self.blocks, self.grid_positions):
             #print "on_moved {} {}".format(i, pos)
         pass
         
 
+
+
+    def has_collided(self):
+        """ checks if we have collided with some other blocks.
+        """
+        # TODO: self.parent is the grid.
+        raise NotImplementedError()
+
+    def make_frozen(self):
+        """ makes this a frozen block in the grid.
+        """
+        # TODO: self.parent is the grid.
+        raise NotImplementedError()
+
+
+
+
+
+    # action_* methods are inputs.
+
     def action_move_left(self):
         # if any of them are going out of bounds, we don't move.
         doit = True
         self.on_moved()
 
 
+
+
+
+
+
+
+
 class Grid(object):
     """ Contains Blocks()
     """
         self.GRID_SIZE_H = GRID_SIZE_H
 
         if self.small:
-            # TODO: get correct coords.
+            # TODO: get correct coords for where the grids are on screen.
             if self.grid_num == 1:
                 self.rect = pygame.Rect(300, 20, GRID_SIZE_W * SBLOCK_W, GRID_SIZE_H * SBLOCK_H)
             if self.grid_num == 2:
             self.rect = pygame.Rect(30, 20, GRID_SIZE_W * BLOCK_W, GRID_SIZE_H * BLOCK_H)
 
         self.restart()
+
     def restart(self):
+        """ restart this Grid instance.
+        """
         self.init_grid()
         self.blocks = Blocks(self)
 
 
     def init_grid(self):
+        """ init_grid initialises the Grid to be all clear.
+        """
         # init our 10x10 grid, to show the color of each grid part.
         #[[(0,0,0), ...],
         # ...