illume avatar illume committed f73f422

Adding comments and some TODO in methods.

Comments (0)

Files changed (2)


         super(Blocks, self).__init__()
         self.parent = parent
+        #TODO: randomise these colors.
         self.colors = [(255,0,0), (0,255,0), (0,0,255)]
         # how do we handle location, and rotation? We say where the grid it is on.
     def has_collided(self):
         """ checks if we have collided with some other blocks.
+              See if the blocks of the same color are below.
         # TODO: self.parent is the grid.
         raise NotImplementedError()
         """ makes this a frozen block in the grid.
         # TODO: self.parent is the grid.
+        #    Probably create a new grid.blocks...
+        #      The Block instances will stay where they are in the sprite_group.
         raise NotImplementedError()
         self.blocks = Blocks(self)
+        # TODO: what about frozen Blocks?
     def init_grid(self):
         """ init_grid initialises the Grid to be all clear.
     """ This contains all the main Grid objects.
     NUM_GRIDS = 4
-    def __init__(self):
+    def __init__(self, sprite_group):
+        """ sprite_group - which we add sprites to.
-        """
+        self.sprite_group = sprite_group
         self.grids = [Grid(x) for x in range(self.NUM_GRIDS)]
+        for grd in self.grids:
+            for b in grd.blocks.blocks:
+                self.sprite_group.add(b)


     sprites = pygame.sprite.LayeredDirty(pot)
-    grds = blocks.Grids()
-    for grd in grds.grids:
-        for b in grd.blocks.blocks:
-            sprites.add(b)
+    grds = blocks.Grids(sprites)
     # player index we are controlling.
     which_player = 0
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
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.