Ejemplo n.º 1
0
 def run(self,screen,player):
     screen.fill((255,255,255))
     Img.bcentre(Img.bfont,"WIN",screen)
     pygame.display.flip()
     pygame.time.wait(1000)
     if not self.p:
         sys.exit()
Ejemplo n.º 2
0
def die(screen):
    pygame.display.flip()
    pygame.time.wait(1000)
    screen.fill((0, 0, 0))
    Img.bcentre(Img.bfont, "FOOL", screen, col=(255, 255, 255))
    pygame.display.flip()
    pygame.time.wait(1000)
Ejemplo n.º 3
0
def Instruct(instructions, time):
    words = instructions.split()
    text = ""
    for i in range(len(words)):
        pygame.event.pump()
        if i:
            text += " "
        text += words[i]
        screen.fill((255, 255, 255))
        Img.bcentre(Img.dfont, text, screen, col=(0, 0, 0))
        pygame.display.flip()
        pygame.time.wait(time)
Ejemplo n.º 4
0
 def run(self,screen,player):
     """The pause GUI should use minimal system resources"""
     pygame.mixer.music.pause()
     screen.fill((255,255,255))
     Img.bcentre(Img.bfont,"Paused",screen)
     pygame.display.flip()
     while True:
         for e in pygame.event.get():
             if e.type==pygame.QUIT:
                 sys.exit()
             if e.type==pygame.KEYDOWN and e.key==pygame.K_p:
                 pygame.mixer.music.unpause()
                 return None
         pygame.time.wait(200)
Ejemplo n.º 5
0
 def win(self,screen):
     success.play()
     screen.fill((255,255,255))
     Img.bcentre(bfont,"YAY",screen)
     if self.score>self.hs:
         self.nhs=True
         Img.bcentre(tfont,"NEW HIGH SCORE: "+str(self.score),screen,100,(0,255,0))
     else:
         Img.bcentre(tfont,"SCORE: "+str(self.score),screen,100)
         Img.bcentre(tfont,"HIGH SCORE: "+str(self.hs),screen,200)
     pygame.display.flip()
     pygame.time.wait(2000)
     self.done="success"
Ejemplo n.º 6
0
 def get_img(self, world):
     screen = Img.blank32.copy()
     Img.bcentre(Img.sfont, str(self.rgb[0]), screen, -8, (self.rgb[0], 0, 0))
     Img.bcentre(Img.sfont, str(self.rgb[1]), screen, 1, (0, self.rgb[1], 0))
     Img.bcentre(Img.sfont, str(self.rgb[2]), screen, 10, (0, 0, self.rgb[2]))
     img = self.img.copy()
     img.blit(screen, (0, 0))
     return img
Ejemplo n.º 7
0
expimg=Img.img2("Exp")
pexpimg=Img.img2("ExpPen")
bombimg=Img.img2("Bomb")
tickimg=Img.img2("Tick")
crossimg=Img.img2("Null")
pimgs=[Img.img2("men/"+x) for x in ["Man2","FMan","SMan","Tman"]]#+[Img.imgstrip("men/CMan")[0]]
breaking = False
Img.musplay("ChOrDs.ogg")
while not breaking:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            sys.exit()
        elif event.type == pygame.MOUSEBUTTONDOWN:
            breaking = True
    screen.fill((255, 0, 0))
    Img.bcentre(tfont,"BOMB BATTLES",screen)
    Img.bcentre(sfont,"Click to start",screen,50)
    pygame.display.flip()
    clock.tick(60)
breaking=False
controllers=[Controllers.Keyboard1(),Controllers.Keyboard2()]+[Controllers.UniJoyController(n) for n in range(pygame.joystick.get_count())]
activecons=[]
acps=[]
rsps=[]
rsc=[]
while not breaking:
    gevents=pygame.event.get()
    for event in gevents:
        if event.type == pygame.QUIT:
            sys.exit()
        elif event.type == pygame.MOUSEBUTTONDOWN and len(rsps)>1:
Ejemplo n.º 8
0
 def fail(self,screen):
     screen.fill((0,0,0))
     Img.bcentre(bfont,"FOOL",screen,col=(255,255,255))
     pygame.display.flip()
     pygame.time.wait(2000)
     self.done="fail"
Ejemplo n.º 9
0
pexpimg = Img.img2("ExpPen")
bombimg = Img.img2("Bomb")
tickimg = Img.img2("Tick")
crossimg = Img.img2("Null")
pimgs = [Img.img2("men/" + x) for x in ["Man2", "FMan", "SMan", "Tman"]
         ]  #+[Img.imgstrip("men/CMan")[0]]
breaking = False
Img.musplay("ChOrDs.ogg")
while not breaking:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            sys.exit()
        elif event.type == pygame.MOUSEBUTTONDOWN:
            breaking = True
    screen.fill((255, 0, 0))
    Img.bcentre(tfont, "BOMB BATTLES", screen)
    Img.bcentre(sfont, "Click to start", screen, 50)
    pygame.display.flip()
    clock.tick(60)
breaking = False
controllers = [Controllers.Keyboard1(),
               Controllers.Keyboard2()] + [
                   Controllers.UniJoyController(n)
                   for n in range(pygame.joystick.get_count())
               ]
activecons = []
acps = []
rsps = []
rsc = []
while not breaking:
    gevents = pygame.event.get()
Ejemplo n.º 10
0
             cont = False
         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)):