Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: cp1252 -*-
- import sys, pygame
- from pygame.locals import *
- #TEXTOAQUITEXTOAQUITEXTOAQUITEXTOAQUITEXTOAQUITEXTOAQUI#
- #TEXTOAQUITEXTOAQUITEXTOAQUITEXTOAQUITEXTOAQUITEXTOAQUI#
- #TEXTOAQUITEXTOAQUITEXTOAQUITEXTOAQUITEXTOAQUITEXTOAQUI#
- #TEXTOAQUITEXTOAQUITEXTOAQUITEXTOAQUITEXTOAQUITEXTOAQUI#
- #TEXTOAQUITEXTOAQUITEXTOAQUITEXTOAQUITEXTOAQUITEXTOAQUI#
- #Arcabouço onde o jogo é montado.
- class Framework:
- width = 800 #Permite alterar a resolução facilmente
- height = 600
- fundo = pygame.Surface((width - 20, height *0.625), SRCALPHA)
- fundo.fill((255,255,255,150))
- screen = pygame.display.set_mode((width, height))
- def __init__(self):
- pygame.mouse.set_visible(1)
- pygame.display.set_caption('Aventura Sem Nome')
- background = pygame.image.load('Background800.jpg').convert()
- self.letra = pygame.font.SysFont('Arnhem', 30)
- self.screen.blit(background, (0,0))
- self.screen.blit(self.fundo, (10, self.height*0.1875))
- while True: #Loop principal do jogo
- for event in pygame.event.get():
- if event.type == pygame.QUIT: pygame.quit() #Clicou no [x] no canto superior direito, sai do jogo
- else:
- Start()
- pygame.display.flip()
- # Serve de Modelo para as demais "páginas" do jogo.
- class Template:
- def __init__(self):
- self.letra = pygame.font.SysFont('Arnhem', 30)
- def tela(self, texto):
- text = self.letra.render(texto, 1, (0,0,0))
- Framework.screen.blit(text, (15, 115))
- def button(self, texto, lugar, elo):
- frame = pygame.image.load('ButtonM.png').convert_alpha()
- frame = pygame.transform.rotozoom(frame, 0, 0.1)
- text = self.letra.render(texto, 1, (0,0,0))
- if lugar == 0: buttonpos = 10, Framework.height-100 #Q
- elif lugar == 1: buttonpos = 120, Framework.height-100 #W
- elif lugar == 2: buttonpos = 240, Framework.height-100 #E
- elif lugar == 3: buttonpos = 360, Framework.height-100 #R
- elif lugar == 4: buttonpos = 10, Framework.height-50 #A
- elif lugar == 5: buttonpos = 120, Framework.height-50 #S
- elif lugar == 6: buttonpos = 240, Framework.height-50 #D
- elif lugar == 7: buttonpos = 360, Framework.height-50 #F
- #textpos = frame.get_rect()
- #textpos.centerx = frame.get_rect().centerx
- #textpos.centery = frame.get_rect().centery
- Framework.screen.blit(frame, buttonpos)
- Framework.screen.blit(text, buttonpos)
- #Página Inicial. Disclaimer, Start Game, Load Game.
- class Start(Template):
- def __init__(self):
- Template.__init__(self)
- disclaimer = Template.tela(self, "Welcome to a still unnamed game.")
- new_button = Template.button(self, "New Game", 0, 0)
- load_button = Template.button(self, "Load Game", 1, 0)
- #Colocando para funcionar
- pygame.init()
- fps = pygame.time.Clock()
- fps.tick(45)
- Framework()
Add Comment
Please, Sign In to add comment