def game_intro(): display_surface.fill(white) display_surface.blit(bg_open, (0, 0)) font = pygame.font.SysFont("comicsansms", 32) text = font.render("Space Invaders", True, (250, 0, 0)) display_surface.blit(text, (280, 115)) font = pygame.font.SysFont("comicsansms", 32) text = font.render("Press Space To Start", True, (0, 255, 0)) display_surface.blit(text, (240, 240)) font = pygame.font.SysFont("comicsansms", 32) text = font.render("Press ESC to Quit", True, (10, 200, 255)) display_surface.blit(text, (255, 345)) font = pygame.font.SysFont("comicsansms", 32) text = font.render("Press I for Instructions", True, (0, 0, 255)) display_surface.blit(text, (223, 450)) pygame.display.update() intro = True while intro: for event in pygame.event.get(): if event.type == pygame.QUIT: intro = False if event.type == pygame.KEYDOWN: if event.key == pygame.K_SPACE: intro = False level1() if event.key == pygame.K_UP: font = pygame.font.SysFont("comicsansms", 32) text = font.render("If you ", True, (10, 200, 255)) display_surface.blit(text, (223, 450)) if event.key == pygame.K_ESCAPE or event.key == pygame.QUIT: pygame.quit() quit()
def main(): pygame.init() global ventana Global.level=0 pygame.mixer.music.load("sonidos/Malmen Facing TheSky.ogg") pygame.mixer.music.play() pygame.mixer.music.set_volume(0.3) pygame.display.set_caption("The Murderer Plant") fondoini=pygame.image.load("imag/tapa.jpg") fondo=pygame.image.load("imag/fondo1.jpg") Tapa=Menu() Raton=Puntero() while True: pygame.mouse.set_visible(False) while Global.level==0: ventana.blit(fondoini,(0,0)) Tapa.dibujar(ventana) posX,posY=pygame.mouse.get_pos() Raton.dibujar(ventana,posX,posY) for evento in pygame.event.get(): if evento.type == QUIT: pygame.quit() sys.exit() #SI CHOCA CON BOTON JUGAR: if Raton.rectimagpuntero.colliderect(Tapa.rectjugar): if pygame.mouse.get_pressed()==(1,0,0): Global.level=1 if Raton.rectimagpuntero.colliderect(Tapa.recttutorial): if pygame.mouse.get_pressed()==(1,0,0): Tapa.ElTutorial(ventana,Raton) #SI CHOCA CON BOTON SALIR: if Raton.rectimagpuntero.colliderect(360,480,85,30): if pygame.mouse.get_pressed()==(1,0,0): pygame.quit() sys.exit() pygame.display.update() if Global.level==1: intro() level1(Raton)
def game(ANCHO, ALTO): terminarp = False level = 1 vidalifemago = 100 while (not terminarp): if (level == 1): level, vidalifemago = level1(ANCHO, ALTO) if (level >= 3): terminarp = True if (level == 2): level = level2(ANCHO, ALTO, vidalifemago) if (level >= 3): terminarp = True
def niveau1(self): self.select.destroy() l1 = level1()