コード例 #1
0
 def button(self, screen, message, font_size, x, y, width, height, inactive_color, active_color, action=None):
      
     self.mouse = pygame.mouse.get_pos()
     self.click = pygame.mouse.get_pressed()         
     
     if x + width > self.mouse[0] > x and y + height > self.mouse[1] > y :
         pygame.draw.rect(screen, inactive_color,(x,y,width,height))
          
         if self.click[0] == 1 and action == "start" and self.can_click:
             "Se o botão continuar for pressionado retorna ao jogo."
             self.can_click = False
             self.can_draw_menu = False
         if self.click[0] == 1 and action == "continue"  and self.can_click:
             self.can_click = False
             self.can_draw_controls = False
         if self.click[0] == 1 and action == "quit":
             "Se o botão continuar for pressionado retorna ao jogo."
             self.quit_game = True
     else:
         pygame.draw.rect(screen, active_color,(x, y, width, height))  
         
     self.text = Fonts.get("Tela do jogo/Zombie.ttf", font_size)
     self.text_surf, self.text_rect = text_objects(message, self.text, black)
     self.text_rect.center = ( (x + (width / 2) ), (y + (height / 2) ) )
     screen.blit(self.text_surf, self.text_rect)
コード例 #2
0
 def __init__(self):
     self.can_draw_menu = True
     self.can_draw_controls = True
     self.can_click = True
     
     self.title = Fonts.get("Menu/Zombie.ttf", 80)
     self.TextSurf, self.TextRect = text_objects("The Final Wall", self.title, red)
     self.TextRect.center = (500),(150)
     
     self.title2 = Fonts.get("Menu/Zombie.ttf", 50)
     self.TextSurf2, self.TextRect2 = text_objects("Controles", self.title, red)
     self.TextRect2.center = (500),(150)
     
     self.quit_game = False
     self.background = background_menu_image
     self.game_controls = game_controls
コード例 #3
0
 def __init__(self):
     self.can_draw = True
     self.quit_game = False
     self.screen_color = red
     self.title = Fonts.get("Tela do jogo/Zombie.ttf", 50)
     self.TextSurf, self.TextRect = text_objects("Fim de jogo", self.title, black)
     self.TextRect.center = (500),(150)
コード例 #4
0
 def button(self, screen, message, font_size, x, y, width, height, inactive_color, active_color, action, transparent, weapon_name, weapons):
      
     self.mouse = pygame.mouse.get_pos()
     self.click = pygame.mouse.get_pressed()         
     
     if x + width > self.mouse[0] > x and y + height > self.mouse[1] > y :
         if not transparent:
             pygame.draw.rect(screen, inactive_color,(x,y,width,height))
          
         if self.click[0] == 1 and action == "continue":
             "Se o botão continuar for pressionado retorna ao jogo."
             self.can_draw = False
           
         # Mostra pagina do diário.   
         elif self.click[0] == 1 and action == "show_page":
             if not self.show_diary_page:
                 self.show_diary_page = True
             else:
                 self.show_diary_page = False 
                 
         # Muda os icones das armas conforme selecionado.
         elif self.click[0] == 1 and action == "change_weapon" and self.can_click:
             self.can_click = False
             if self.select_weapon == 1:
                 self.select_weapon = 2
                 if weapon_name == "pistol":
                     self.weapon_1_name = "pistol"
                     self.primary_weapon_icon = self.pistol_icon
                 if weapon_name == "revolver" and weapons[1].available:
                     self.weapon_1_name = "revolver"
                     self.primary_weapon_icon = self.revolver_icon
                 if weapon_name == "ak_47" and weapons[2].available:
                     self.weapon_1_name = "ak_47"
                     self.primary_weapon_icon = self.ak_47_icon
                 if weapon_name == "sniper_rifle" and weapons[3].available:
                     self.weapon_1_name = "sniper_rifle"
                     self.primary_weapon_icon = self.sniper_icon               
             else:
                 self.select_weapon = 1
                 if weapon_name == "pistol":
                     self.weapon_2_name = "pistol"
                     self.secondary_weapon_icon = self.pistol_icon
                 if weapon_name == "revolver" and weapons[1].available:
                     self.weapon_2_name = "revolver"
                     self.secondary_weapon_icon = self.revolver_icon
                 if weapon_name == "ak_47" and weapons[2].available:
                     self.weapon_2_name = "ak_47"
                     self.secondary_weapon_icon = self.ak_47_icon
                 if weapon_name == "sniper_rifle" and weapons[3].available:
                     self.weapon_2_name = "sniper_rifle"
                     self.secondary_weapon_icon = self.sniper_icon
     elif not transparent:
         pygame.draw.rect(screen, active_color,(x, y, width, height))  
         
     self.text = Fonts.get("Tela do jogo/zombieCat.ttf", font_size)
     self.text_surf, self.text_rect = text_objects(message, self.text, black)
     self.text_rect.center = ( (x + (width / 2) ), (y + (height / 2) ) )
     screen.blit(self.text_surf, self.text_rect)
コード例 #5
0
 def __init__(self):
     self.can_draw = True
     self.quit_game = False
     self.screen_color = black
     self.title = Fonts.get("Tela do jogo/Zombie.ttf", 50)
     self.game_controls = game_controls
     self.TextSurf, self.TextRect = text_objects("Fim de jogo", self.title, black)
     self.TextRect.center = (490),(150)
     self.helicopter_sound = helicopter_sound
コード例 #6
0
    def __init__(self):
        self.hours = 8
        self.hours_wall = 0
        self.hours_weapons = 0
        self.can_draw = True
        self.can_click = True
        self.image = background_next_day_image
        self.menu_music = menu_music
        
        self.title = Fonts.get("Tela do jogo/Zombie.ttf", 50)
        self.TextSurf, self.TextRect = text_objects("Voce sobreviveu aos zumbis", self.title, red)
        self.TextRect.center = (500),(150)
        
        self.title_2 = Fonts.get("Tela do jogo/Zombie.ttf", 25)
        self.TextSurf_2, self.TextRect_2 = text_objects("Horas restantes ", self.title_2, red)
        self.TextRect_2.center = (450),(230)

        self.TextSurf_3, self.TextRect_3 = text_objects("Procurar armas ", self.title_2, red)
        self.TextRect_3.center = (450),(330)
        
        self.TextSurf_4, self.TextRect_4 = text_objects("Arrumar muro ", self.title_2, red)
        self.TextRect_4.center = (450),(430)
コード例 #7
0
 def button(self, screen, message, font_size, x, y, width, height, inactive_color, active_color, action=None):
      
     self.mouse = pygame.mouse.get_pos()
     self.click = pygame.mouse.get_pressed()         
     
     if x + width > self.mouse[0] > x and y + height > self.mouse[1] > y :
         pygame.draw.rect(screen, inactive_color,(x,y,width,height))
          
         if self.click[0] == 1 and action == "unpause":
             "Se o botão continuar for pressionado retorna ao jogo."
             self.can_draw = False
         if y == 305:
             if self.click[0] == 1 and action == "more" and self.can_click:
                 if self.hours > 0:
                     self.can_click = False
                     self.hours -= 1
                     self.hours_weapons += 1
                      
             if self.click[0] == 1 and action == "less" and self.can_click:
                 if self.hours_weapons > 0:
                     self.can_click = False
                     self.hours += 1
                     self.hours_weapons -= 1  
      
         if y == 405:
             if self.click[0] == 1 and action == "more" and self.can_click:
                 if self.hours > 0:
                     self.can_click = False
                     self.hours -= 1
                     self.hours_wall += 1   
                      
             if self.click[0] == 1 and action == "less" and self.can_click:
                 if self.hours_wall > 0:
                     self.can_click = False
                     self.hours += 1
                     self.hours_wall -= 1  
     else:
         pygame.draw.rect(screen, active_color,(x, y, width, height))    
          
     self.text = Fonts.get("Tela do jogo/zombieCat.ttf", font_size)
     self.text_surf, self.text_rect = text_objects(message, self.text, black)
     self.text_rect.center = ( (x + (width / 2) ), (y + (height / 2) ) )
     screen.blit(self.text_surf, self.text_rect)         
コード例 #8
0
 def button(self, screen, message, font_size, x, y, width, height, inactive_color, active_color, action=None):
      
     self.mouse = pygame.mouse.get_pos()
     self.click = pygame.mouse.get_pressed()         
     
     if x + width > self.mouse[0] > x and y + height > self.mouse[1] > y :
         pygame.draw.rect(screen, inactive_color,(x,y,width,height))
          
         if self.click[0] == 1 and action == "continue":
             self.reset_game()
             self.can_draw = False
         if self.click[0] == 1 and action == "quit":
             self.quit_game = True
     else:
         pygame.draw.rect(screen, active_color,(x, y, width, height))  
         
     self.text = Fonts.get("Tela do jogo/zombieCat.ttf", font_size)
     self.text_surf, self.text_rect = text_objects(message, self.text, black)
     self.text_rect.center = ( (x + (width / 2) ), (y + (height / 2) ) )
     screen.blit(self.text_surf, self.text_rect)
コード例 #9
0
#-*-coding:latin1-*-
'''
Created on 05/10/2015

@author: Guilherme Campiotto
'''
import pygame
from AssetsManager import Fonts, Images
Fonts.init()
Images.init()

white = (255, 255, 255)
red = (200, 0, 0)

font_screen = Fonts.get(
    "Tela do jogo/Zombie.ttf",
    20)  #pygame.font.Font("Fontes\Tela do jogo\Zombie.ttf", 20)
pause_icon_original = Images.get("Pausa.png")
pause_icon = pygame.transform.scale(pause_icon_original, (98, 56))


class ScreenInfo(object):
    def __init__(self):
        self.font = font_screen
        self.pause_icon = pause_icon

    def draw(self, screen, ammo, enemys_left, level, weapon_name,
             barricade_resistance):
        screen.blit(self.font.render("Dia ", True, red), (50, 25))
        screen.blit(self.font.render(str(level), True, red), (150, 25))
        screen.blit(self.font.render("Arma ", True, red), (50, 50))