Guest User

Untitled

a guest
Jun 21st, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.03 KB | None | 0 0
  1. # -*- coding: cp1252 -*-
  2. import sys, pygame
  3. from pygame.locals import *
  4.  
  5. #TEXTOAQUITEXTOAQUITEXTOAQUITEXTOAQUITEXTOAQUITEXTOAQUI#
  6. #TEXTOAQUITEXTOAQUITEXTOAQUITEXTOAQUITEXTOAQUITEXTOAQUI#
  7. #TEXTOAQUITEXTOAQUITEXTOAQUITEXTOAQUITEXTOAQUITEXTOAQUI#
  8. #TEXTOAQUITEXTOAQUITEXTOAQUITEXTOAQUITEXTOAQUITEXTOAQUI#
  9. #TEXTOAQUITEXTOAQUITEXTOAQUITEXTOAQUITEXTOAQUITEXTOAQUI#
  10.  
  11. #Arcabouço onde o jogo é montado.
  12. class Framework:
  13.     width = 800     #Permite alterar a resolução facilmente
  14.     height = 600
  15.     fundo = pygame.Surface((width - 20, height *0.625), SRCALPHA)
  16.     fundo.fill((255,255,255,150))
  17.     screen = pygame.display.set_mode((width, height))
  18.    
  19.     def __init__(self):
  20.         pygame.mouse.set_visible(1)
  21.         pygame.display.set_caption('Aventura Sem Nome')
  22.         background = pygame.image.load('Background800.jpg').convert()
  23.         self.letra = pygame.font.SysFont('Arnhem', 30)
  24.         self.screen.blit(background, (0,0))
  25.         self.screen.blit(self.fundo, (10, self.height*0.1875))
  26.        
  27.         while True:     #Loop principal do jogo
  28.             for event in pygame.event.get():
  29.                 if event.type == pygame.QUIT: pygame.quit() #Clicou no [x] no canto superior direito, sai do jogo
  30.                 else:
  31.                     Start()
  32.                     pygame.display.flip()
  33.  
  34. # Serve de Modelo para as demais "páginas" do jogo.      
  35. class Template:
  36.     def __init__(self):
  37.         self.letra = pygame.font.SysFont('Arnhem', 30)
  38.  
  39.     def tela(self, texto):
  40.         text = self.letra.render(texto, 1, (0,0,0))
  41.         Framework.screen.blit(text, (15, 115))
  42.  
  43.     def button(self, texto, lugar, elo):
  44.         frame = pygame.image.load('ButtonM.png').convert_alpha()
  45.         frame = pygame.transform.rotozoom(frame, 0, 0.1)
  46.         text = self.letra.render(texto, 1, (0,0,0))
  47.         if lugar == 0: buttonpos = 10, Framework.height-100       #Q
  48.         elif lugar == 1: buttonpos = 120, Framework.height-100    #W
  49.         elif lugar == 2: buttonpos = 240, Framework.height-100    #E
  50.         elif lugar == 3: buttonpos = 360, Framework.height-100    #R
  51.         elif lugar == 4: buttonpos = 10, Framework.height-50      #A
  52.         elif lugar == 5: buttonpos = 120, Framework.height-50     #S
  53.         elif lugar == 6: buttonpos = 240, Framework.height-50     #D
  54.         elif lugar == 7: buttonpos = 360, Framework.height-50     #F
  55.         #textpos = frame.get_rect()
  56.         #textpos.centerx = frame.get_rect().centerx
  57.         #textpos.centery = frame.get_rect().centery
  58.         Framework.screen.blit(frame, buttonpos)
  59.         Framework.screen.blit(text, buttonpos)
  60.  
  61. #Página Inicial. Disclaimer, Start Game, Load Game.
  62. class Start(Template):
  63.     def __init__(self):
  64.         Template.__init__(self)
  65.         disclaimer = Template.tela(self, "Welcome to a still unnamed game.")
  66.         new_button = Template.button(self, "New Game", 0, 0)
  67.         load_button = Template.button(self, "Load Game", 1, 0)
  68.  
  69.          
  70. #Colocando para funcionar    
  71. pygame.init()
  72. fps = pygame.time.Clock()
  73. fps.tick(45)
  74.  
  75. Framework()
Add Comment
Please, Sign In to add comment