Esempio n. 1
0
 def move_hero_keys(
     self,
     keys: Union[MovementKeys, Tuple[str, str, str,
                                     str]] = ("up", "down", "left", "right")
 ) -> Tuple[bool, bool]:
     if not isinstance(keys, MovementKeys):
         keys = MovementKeys(*keys)
     keys = MovementKeys(*keys)
     keyboard = Window.get_keyboard()
     hx, hy = self.hero_position
     h, v = False, False
     if keyboard.key_pressed(keys.up):
         hy -= 1
         v = not v
     if keyboard.key_pressed(keys.down):
         hy += 1
         v = not v
     if keyboard.key_pressed(keys.left):
         hx -= 1
         h = not h
     if keyboard.key_pressed(keys.right):
         hx += 1
         h = not h
     hero_position = Vector(hx, hy)
     if (h or v) and self.can_move_to(hero_position):
         self.move_hero_to(hero_position)
         return h, v
     else:
         return False, False
Esempio n. 2
0
    def __init_components__(self):
        #sessão de janela
        self._window = Window(640, 480)
        self._window.title = "Crystal Path -"

        self._fundo_sound = Sound("../Sounds/menuprincipal.ogg")
        self._fundo_sound.sound.set_volume(10/100)

        #janela Menu Principal
        self._window_background_menu_initial = GameImage("../MENU/Background.png")
        self._logo = GameImage("../MENU/LOGO.png")
        self._new_game_button = GameImage("../MENU/BOTAO - Iniciar.png")
        self._continue_game_button = GameImage("../MENU/BOTAO - Continuar.png")
        self._exit_game_button = GameImage("../MENU/BOTAO - Sair.png")

        #janela Seleção de personagens
        self._window_background_menu_char = GameImage("../CharMenu/Background.png")
        self._guerreiro_menu = GameImage("../CharMenu/Guerreiromenu.png")
        self._feiticeira_menu = GameImage("../CharMenu/Feiticeiramenu.png")
        self._arqueiro_menu = GameImage("../CharMenu/Arqueiromenu.png")

        #seleção de fase
        self._fase_1 = GameImage("../FaseMenu/fase1.png")
        self._fase_2 = GameImage("../FaseMenu/fase2.png")
        self._fase_3 = GameImage("../FaseMenu/fase3.png")
        self._mapa = GameImage("../FaseMenu/mapa.png")
        self._mapa_som = Sound("../Sounds/teriasong.ogg")
        self._mapa_som.sound.set_volume(15/100)

        #seleção do jogo

        #jogo

        #personagens
        self._guerreiro = GameImage("../CharMenu/Guerreiromenu.png")
        self._feiticeira = GameImage("../CharMenu/Feiticeiramenu.png")
        self._arqueiro = GameImage("../CharMenu/Arqueiromenu.png")


        #Controle
        self._execute = True
        self._window_to_display_ = 1
        self._mouse = Window.get_mouse()
        self._keyboard = Window.get_keyboard()

        #Não tem player selecionado. Será :
        # 1. Guerreiro
        # 2. Feiticeiro
        # 3. Arqueiro
        self._current_player_type_ = False
        self._current_game_option_ = False
Esempio n. 3
0
 def move_hero_key_y(
     self,
     keys: Union[MovementKeys, MovementKeysUD, Tuple[str,
                                                     str]] = ("up", "down")
 ) -> bool:
     if not isinstance(keys, (MovementKeysUD, MovementKeys)):
         keys = MovementKeysUD(*keys)
     keyboard = Window.get_keyboard()
     hx, hy = self.hero_position
     moved = False
     if keyboard.key_pressed(keys.up):
         hy -= 1
         moved = not moved
     if keyboard.key_pressed(keys.down):
         hy += 1
         moved = not moved
     hero_position = Vector(hx, hy)
     if moved and self.can_move_to(hero_position):
         self.move_hero_to(hero_position)
         return moved
     return False
Esempio n. 4
0
 def move_hero_key_x(
     self,
     keys: Union[MovementKeys, MovementKeysLR,
                 Tuple[str, str]] = ("left", "right")
 ) -> bool:
     if not isinstance(keys, (MovementKeysLR, MovementKeys)):
         keys = MovementKeysLR(*keys)
     keyboard = Window.get_keyboard()
     hx, hy = self.hero_position
     moved = False
     if keyboard.key_pressed(keys.left):
         hx -= 1
         moved = not moved
     if keyboard.key_pressed(keys.right):
         hx += 1
         moved = not moved
     hero_position = Vector(hx, hy)
     if moved and self.can_move_to(hero_position):
         self.move_hero_to(hero_position)
         return moved
     return False
Esempio n. 5
0
from PPlay.window import Window
import binary_break.globals as globals
from binary_break.screens.menu import Menu

window = Window(842, 700)
keyboard = window.get_keyboard()

globals.window = window
globals.difficulty = 1
globals.backgroundColor = (10, 11, 56)
globals.game_speed = 1
globals.currentContainer = Menu()

while True:
    globals.delta_time = window.delta_time()
    globals.currentContainer.render()
    window.update()
Esempio n. 6
0
from PPlay.gameimage import GameImage
from arvore import Arvore
from bodybuilder import BodyBuilder
from pontuador import Pontuador
from highscoremanager import ScoreManager

janela = Window(512, 512)
janela.set_title('TimberBAM')

background = GameImage('sprite/cenario/cenarionew.png')
menu_bg = GameImage('sprite/cenario/start.png')
botao_inicial = GameImage('sprite/cenario/botao.png')
tela_final = GameImage('sprite/cenario/GAMEOVER.png')
score_manager = ScoreManager()

teclado = janela.get_keyboard()

arvore = Arvore(janela)
bambam = BodyBuilder(janela, 'esquerda')
pontuador = Pontuador(janela)

teclado_pressionado = False
record_checked = False

game_state = 2  # 0 - JOGANDO  1 - GAME-OVER  2- IN-MENU

while True:
    if game_state == 0:
        if teclado.key_pressed('left') or teclado.key_pressed('right'):
            if not teclado_pressionado:
                lado = 1 if teclado.key_pressed('left') else 0