1. pygame
  2. Untitled project
  3. pygamegsoc12

Commits

"Sam...@sambull.org>"  committed b088e0d

Added base potion code.

  • Participants
  • Parent commits b4d4631
  • Branches default

Comments (0)

Files changed (2)

File alchemymadness/main.py

View file
 import pygame
 from pygame.locals import *
 
+import potion
+
+SCREEN_SIZE = (640, 480)
 
 
 def main():
     """
 
     pygame.init()
-    screen = pygame.display.set_mode((640, 480))
+    screen = pygame.display.set_mode(SCREEN_SIZE)
+    clock = pygame.time.Clock()
     going = True
 
-    screen.fill((255,0,0))
+    screen.fill((0,0,0))
+    background = pygame.surface.Surface(SCREEN_SIZE)
+
+    # Tetris area
+    pygame.draw.rect(background, (0,0,255),
+                     (10, 10, SCREEN_SIZE[0]*.4, SCREEN_SIZE[1]*.7), 1)
+
+    screen.blit(background, (0,0))
     pygame.display.flip()
 
+    # Initialise level
+    potion.set_formula(10, 20, 30)
+
     while going:
+        time = clock.tick(30)
         events = pygame.event.get()
         for e in events:
             if e.type == QUIT or e.type == KEYDOWN and e.key == K_ESCAPE:
                 going = False
 
+        screen.blit(background, (0,0))
         rects = []
         pygame.display.update(rects)
 
+    # End game
+    score = potion.get_score()
 
     pygame.quit()

File alchemymadness/potion.py

View file
+"""Mixing potion"""
+
+def set_formula(r=0, g=0, b=0):
+    """Set the target formula for the level."""
+    pass
+
+def add_color(col):
+    """
+    Add a colour from a player's board.
+
+    Args:
+      col: tuple containing rgb colour.
+
+    """
+    pass
+
+def get_score():
+    """Returns a score based on accuracy of the formula."""
+    pass