Exemple #1
0
 def run(self, screen, player):
     recrects = []
     while True:
         for e in pygame.event.get():
             if e.type==pygame.QUIT:
                 sys.exit()
             if e.type == pygame.MOUSEBUTTONDOWN:
                 mpos = pygame.mouse.get_pos()
                 for rr in recrects:
                     if rr[1].collidepoint(mpos):
                         self.cr.recipe = rr[0]
                         self.cr.recipeprogress = GameRegistry.craftrecipes[rr[0]][0][:]
             elif e.type==pygame.KEYDOWN and e.key==pygame.K_LSHIFT:
                 return None
         screen.fill((200, 200, 200))
         recrects = []
         Img.fblit(screen, Img.dfont, "CRAFTING: ", (0, 0, 0), (0, 0))
         Img.fblit(screen,Img.sfont,", ".join(self.cr.recipeprogress),(0, 0, 0), (0, 32))
         if self.cr.recipeprogress == GameRegistry.craftrecipes[self.cr.recipe][0]:
             for n, r in enumerate(GameRegistry.craftrecipes):
                 recrects.append([n, screen.blit(r[2], (n * 32, 64))])
         pygame.display.flip()
Exemple #2
0
         for gr, n in grects:
             if gr.collidepoint(mpos):
                 wgen = n
         for ws, n in wsrects:
             if ws.collidepoint(mpos):
                 wsizemod = n
         for ps, n in psrects:
             if ps.collidepoint(mpos):
                 pset = n
     elif ev.type == pygame.KEYDOWN:
         if ev.key == pygame.K_g and pygame.key.get_mods() & pygame.KMOD_LCTRL:
             godmode = True
 screen.fill(rgb)
 screen.blit(nland, (0, 0))
 Img.bcentre(Img.bfont, "MONOLITH", screen, -200)
 tutb = Img.fblit(screen, Img.dfont, "TUTORIAL", (255, 0, 0), (0, 0))
 grects = []
 wsrects = []
 if not puzzles:
     screen.blit(Img.dfont.render("GENERATOR:", True, (100, 100, 100)), (0, 480))
     screen.blit(Img.dfont.render("SIZE:", True, (100, 100, 100)), (490, 480))
     for n in range(len(Generators.gens)):
         grects.append((pygame.draw.rect(screen, (200, 200, 200) if n == wgen else (100, 100, 100),
                                         pygame.Rect(2 + n * 50, 512, 48, 48)), n))
     for n in range(3):
         wsrects.append((pygame.draw.rect(screen, (200, 200, 200) if n == wsizemod else (100, 100, 100),
                                          pygame.Rect(490 + n * 50, 512, 48, 48)), n))
 if puzzles:
     screen.blit(Img.dfont.render("PUZZLE SET:", True, (100, 100, 100)), (0, 480))
     for n in range(len(Generators.puzzles)):
         psrects.append((pygame.draw.rect(screen, (200, 200, 200) if n == pset else (100, 100, 100),