def __init__(self): self.screen = pygame.display.set_mode( (init_screen.WIDTH, init_screen.HEIGHT)) self.image = pygame.image.load('bg.jpg').convert() self.screen = init_screen.init_screen(self.screen, self.image) self.pattern = 1 self.setHusar = True self.setCossacsThirdBattle = True self.setInfantryThirdBattle = True self.myFont = pygame.font.SysFont("monospace", 20) self.firstLabel = self.myFont.render("Bitwa pod Chocimiem 1509", 1, (0, 0, 0)) self.secondLabel = self.myFont.render("Bitwa pod Chocimiem 1621", 1, (0, 0, 0)) self.thirdLabel = self.myFont.render("Bitwa pod Chocimiem 1673", 1, (0, 0, 0))
pygame.mixer.init() # Tamanho da tela. screen = pygame.display.set_mode((WIDTH, HEIGHT)) # Nome do jogo pygame.display.set_caption("Capture The Flegg") game_status = GameStatus(screen) # Comando para evitar travamentos. try: state = INIT while state != QUIT: if state == INIT: state = init_screen(game_status) elif state == GAME: state = game(game_status) elif state == WINV: state = win_screen_red(game_status) elif state == WINA: state = win_screen_blue(game_status) elif state == SETTINGS: state = settings(game_status) elif state == CREDITS: state = creditss(game_status) else: state = QUIT finally: pygame.quit()
""" # ===== Inicialização ===== # ----- Importa e inicia pacotes import pygame from config import SW, SH, INIT, GAME, QUIT, END from init_screen import init_screen from game_screen import game_screen from end_screen import end_screen pygame.init() pygame.mixer.init() # ----- Gera tela principal window = pygame.display.set_mode((SW, SH)) pygame.display.set_caption('Breakout') state = INIT while state != QUIT: if state == INIT: state = init_screen(window) elif state == GAME: state = game_screen(window) elif state == END: state = end_screen(window) # ===== Finalização ===== pygame.quit()
import time from os import path from config import WIDTH, HEIGHT, INIT, GAME, QUIT from init_screen import init_screen from game_screen import game_screen # Inicialização do Pygame. pygame.init() pygame.mixer.init() # Tamanho da tela. screen = pygame.display.set_mode((WIDTH, HEIGHT)) # Nome do jogo pygame.display.set_caption("Navinha") # Comando para evitar travamentos. try: state = INIT while state != QUIT: if state == INIT: state = init_screen(screen) elif state == GAME: state = game_screen(screen) else: state = QUIT finally: pygame.quit()
pygame.init() pygame.mixer.init() # ----- Gera tela principal janela = pygame.display.set_mode( [WIDTH, HEIGHT]) # define uma surface ("janela" que o jogo será exibido) pygame.display.set_caption("Late Santa") # define um nome para a janela aberta #Definindo recorde como 0 record = 0 #Estado inicial: INIT state = INIT while state != QUIT: if state == INIT: state = init_screen(janela, record) elif state == CHOOSE: #Recebe o estado do jogo e o sprite escolhido pelo jogador returns = choose_screen(janela) state = returns[0] sprite_jogo = returns[1] elif state == GAME: #Recebe o estado do jogo, o score e o record returns = game_screen(janela, record, sprite_jogo) state = returns[0] score = returns[1] record = returns[2] elif state == DEAD:
all_sprites.add(m) walls.add(m) # Cria 8 meteoros e adiciona no grupo meteoros for i in range(1): m = Mob('fire', fire_anim) all_sprites.add(m) mobs.add(m) # Comando para evitar travamentos. try: # Loop principal. #pygame.mixer.music.play(loops=-1) running = True init_screen(screen) while running: # Ajusta a velocidade do jogo. clock.tick(FPS) # Processa os eventos (mouse, teclado, botão, etc). for event in pygame.event.get(): # Verifica se foi fechado. if event.type == pygame.QUIT: running = False # Verifica se apertou alguma tecla. if event.type == pygame.KEYDOWN: # Dependendo da tecla, altera a velocidade.
assets['tela_inicial'] = pygame.image.load( path.join(img_dir, 'tela_inicial.png')).convert() assets['tela_final'] = pygame.image.load( path.join(img_dir, 'tela_final.png')).convert() return assets pygame.init() pygame.mixer.init() screen = pygame.display.set_mode((WIDTH, HEIGHT)) pygame.display.set_caption("SuperFox by TeamAura") assets = load_assets(img_dir, snd_dir, fnt_dir) try: state = INIT while state != QUIT: if state == INIT: state = init_screen(screen, assets) elif state == GAME: state = game_screen(screen, assets) elif state == DONE: state = final_screen(screen, assets) else: state = QUIT finally: pygame.quit()
import pygame from config import WIDTH, HEIGHT, START, PLAYING, DONE, GAMEOVER from init_screen import init_screen from game_screen import game_screen from gameover_screen import gameover_screen #inicia o mixer e a tela do pygame pygame.init() pygame.mixer.init() #Gera tela principal window = pygame.display.set_mode((WIDTH, HEIGHT)) pygame.display.set_caption('CrazyPong') state = START while state != DONE: if state == START: state = init_screen(window) #tela de inicio elif state == PLAYING: state = game_screen(window) #tela do jogo elif state == GAMEOVER: state = gameover_screen(window) #tela de gameover else: state = DONE # ===== Finalização ===== pygame.quit() # Função do PyGame que finaliza os recursos utilizados