Skip to content

Commit

Permalink
Jogo terminado 23:59
Browse files Browse the repository at this point in the history
  • Loading branch information
ghzeni committed Jun 20, 2018
1 parent e6240ab commit c635b33
Show file tree
Hide file tree
Showing 49 changed files with 110 additions and 7,713 deletions.
Binary file modified .vs/Excalibur/v15/.suo
Binary file not shown.
Binary file modified .vs/Excalibur/v15/Browse.VC.db
Binary file not shown.
Binary file modified .vs/Excalibur/v15/ipch/4c0f43b0f46ac49f.ipch
Binary file not shown.
Binary file modified .vs/Excalibur/v15/ipch/a2dec3b5f0dfa2f.ipch
Binary file not shown.
Binary file modified Debug/Excalibur.ilk
Binary file not shown.
Binary file modified Debug/Excalibur.pdb
Binary file not shown.
3,217 changes: 0 additions & 3,217 deletions Excalibur._ml

This file was deleted.

4,366 changes: 0 additions & 4,366 deletions Excalibur.~ml

This file was deleted.

Binary file removed Excalibur/Aula_01_introdução_2018_1.pdf
Binary file not shown.
8 changes: 4 additions & 4 deletions Excalibur/Chefao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,27 +111,27 @@ void Chefao::Draw(sf::RenderWindow& window)

void Chefao::OnCollision(sf::Vector2f direcao)
{
if (direcao.x < 0.0f) //Colisão à direita
if (direcao.x < 0.0f)
{
velocidade.x = 0.0f;
moveRight = false;
tempoEsquerda = relogio2.restart().asSeconds();
}

else if (direcao.x > 0.0f) //Colisão na esquerda
else if (direcao.x > 0.0f)
{
velocidade.x = 0.0f;
moveRight = true;
tempoEsquerda = relogio2.restart().asSeconds();
}

if (direcao.y < 0.0f) //Colisão em cima
if (direcao.y < 0.0f)
{
velocidade.y = 0.0f;
moveUp = true;
tempoDescida = relogio1.restart().asSeconds();
}
else if (direcao.y > 0.0f) //Colisão embaixo
else if (direcao.y > 0.0f)
{
moveUp = false;
velocidade.y = 0.0f;
Expand Down
16 changes: 15 additions & 1 deletion Excalibur/Debug/Excalibur.log
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
 Fase2.cpp
 Chefao.cpp
Esqueleto.cpp
Fase.cpp
Fase1.cpp
Fase2.cpp
Gosma.cpp
Inimigo.cpp
Jogador.cpp
Jogo.cpp
Menu.cpp
Morcego.cpp
Personagem.cpp
main.cpp
Gerando Código...
c:\users\lenovo t430\lenovo-t430 salvar\utfpr\prog2\excalibur\excalibur\fase1.cpp(254): warning C4715: 'Fase1::Executar': nem todos os caminhos de controle retornam um valor
Excalibur.vcxproj -> C:\Users\Lenovo T430\Lenovo-T430 Salvar\UTFPR\Prog2\Excalibur\Debug\Excalibur.exe
Binary file modified Excalibur/Debug/Excalibur.tlog/CL.command.1.tlog
Binary file not shown.
Binary file modified Excalibur/Debug/Excalibur.tlog/CL.read.1.tlog
Binary file not shown.
Binary file modified Excalibur/Debug/Excalibur.tlog/CL.write.1.tlog
Binary file not shown.
Binary file modified Excalibur/Debug/vc141.idb
Binary file not shown.
Binary file modified Excalibur/Debug/vc141.pdb
Binary file not shown.
4 changes: 2 additions & 2 deletions Excalibur/Esqueleto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void Esqueleto::Update(float deltaTime)
else
velocidade.x = -speed;

velocidade.y += 981.0f * deltaTime; //gravidade
velocidade.y += 981.0f * deltaTime;

if (velocidade.x == 0.0f)
row = 0;
Expand All @@ -48,7 +48,7 @@ void Esqueleto::Update(float deltaTime)

animacao.Update(row, deltaTime, faceRight);
body.setTextureRect(animacao.uvRect);
body.move(velocidade * deltaTime); //move não ser mais frame-específico
body.move(velocidade * deltaTime);
}

void Esqueleto::Draw(sf::RenderWindow& window)
Expand Down
1 change: 0 additions & 1 deletion Excalibur/Esqueleto.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class Esqueleto :
void OnCollision(sf::Vector2f direcao);
void ColidiuPersonagem(sf::Vector2f direcao, int dano);
int getHealth() { return health; }
/*void setDamage(int dano) { health -= dano; }*/
void ColidiuObstaculo(sf::Vector2f direcao, int dano);


Expand Down
24 changes: 12 additions & 12 deletions Excalibur/Fase1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,18 @@ int Fase1::Executar(Jogador* player, Jogador **player2, sf::RenderWindow& window
{
switch (evnt->type)
{
case sf::Event::KeyReleased: //pausar o jogo //adicionei isso
switch ((*evnt).key.code)//adicionei isso
case sf::Event::KeyReleased: //pausar o jogo
switch ((*evnt).key.code)
{
case sf::Keyboard::Escape://adicionei isso
pausou = true;//adicionei isso
break;//adicionei isso

case sf::Keyboard::F5://adicionei isso
pausou = false;//adicionei isso
break;//adicionei isso
}//adicionei isso
break;//adicionei isso
case sf::Keyboard::Escape:
pausou = true;
break;

case sf::Keyboard::F5:
pausou = false;
break;
}
break;

case sf::Event::Closed:
window.close();
Expand All @@ -113,7 +113,7 @@ int Fase1::Executar(Jogador* player, Jogador **player2, sf::RenderWindow& window
}
}

if (!pausou)//condição para pausar
if (!pausou) //condição para pausar
{
player->playerUpdate(deltaTime, twoplayers);

Expand Down
2 changes: 1 addition & 1 deletion Excalibur/Fase1.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Fase1 :
Fase1();
~Fase1();
int Executar(Jogador* player, Jogador **player2, sf::RenderWindow& window, sf::View& view, bool* twoplayers);
void ResizeView(const sf::RenderWindow& window, sf::View& view); //verificar
void ResizeView(const sf::RenderWindow& window, sf::View& view);

private:
bool *twoplayers;
Expand Down
34 changes: 18 additions & 16 deletions Excalibur/Fase2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ Fase2::~Fase2()

int Fase2::Executar(Jogador* player, Jogador **player2, sf::RenderWindow& window, sf::View& view, bool* twoplayers)
{

this->twoplayers = twoplayers;

player->SetPosition(120.0f, -200.0f);
if (*twoplayers)
(*player2)->SetPosition(120.0f, -200.0f);
this->twoplayers = twoplayers;



for (int i = 0; i < num_esqueletos; i++)
{
Expand Down Expand Up @@ -81,18 +83,18 @@ int Fase2::Executar(Jogador* player, Jogador **player2, sf::RenderWindow& window
switch (evnt->type)
{

case sf::Event::KeyReleased: //pausar o jogo //adicionei isso
switch ((*evnt).key.code)//adicionei isso
case sf::Event::KeyReleased: //pausar o jogo
switch ((*evnt).key.code)
{
case sf::Keyboard::Escape://adicionei isso
pausou = true;//adicionei isso
break;//adicionei isso

case sf::Keyboard::F5://adicionei isso
pausou = false;//adicionei isso
break;//adicionei isso
}//adicionei isso
break;//adicionei isso
case sf::Keyboard::Escape:
pausou = true;
break;

case sf::Keyboard::F5:
pausou = false;
break;
}
break;

case sf::Event::Closed:
window.close();
Expand All @@ -105,7 +107,7 @@ int Fase2::Executar(Jogador* player, Jogador **player2, sf::RenderWindow& window
}
}

if (!pausou)//condição para pausar
if (!pausou)
{
player->playerUpdate(deltaTime, twoplayers);

Expand Down Expand Up @@ -205,8 +207,8 @@ int Fase2::Executar(Jogador* player, Jogador **player2, sf::RenderWindow& window
}


view.setCenter(player->GetPosition()); //depois de update sempre
window.clear(sf::Color(30, 30, 30)); // RED=0, GREEN=255, BLUE=0
view.setCenter(player->GetPosition());
window.clear(sf::Color(30, 30, 30));
window.draw(background);
window.setView(view);
player->Draw(window);
Expand Down
53 changes: 1 addition & 52 deletions Excalibur/Jogo.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#include "stdafx.h"
#include "Jogo.h"

//classe plataforma derivada de item
//delete vector

Jogo::Jogo() :
window(sf::VideoMode(512, 512), "Excalibur", sf::Style::Close | sf::Style::Resize),
Expand All @@ -12,7 +10,7 @@ Jogo::Jogo() :
menu = new Menu(static_cast <float> (window.getSize().x), static_cast <float> (window.getSize().y));
playerTexture.loadFromFile("tux_menino.png");
player2Texture.loadFromFile("tux_menina.png");
player = new Jogador(&playerTexture, sf::Vector2u(3, 9), 0.3f, 100.0f, 5, 1, 0, 200.f, 1); //speed = 100.0f
player = new Jogador(&playerTexture, sf::Vector2u(3, 9), 0.3f, 100.0f, 5, 1, 0, 200.f, 1);
player2 = new Jogador(&player2Texture, sf::Vector2u(3, 9), 0.3f, 100.0f, 5, 1, 1, 200.f, 1);
fase01 = new Fase1;
fase02 = new Fase2;
Expand Down Expand Up @@ -121,52 +119,3 @@ void Jogo::Executar()
}
}

//void Jogo::Executar()
//{
//
// while (window.isOpen())
// {
// deltaTime = clock.restart().asSeconds();
// if (deltaTime > 1.0f / 20.0f)
// deltaTime = 1.0f / 20.0f;
//
// sf::Event evnt; //verificar
//
// while (window.pollEvent(evnt))
// {
// switch (evnt.type)
// {
//
// case sf::Event::Closed:
// window.close();
// break;
//
// case sf::Event::Resized:
// ResizeView(window, view);
// break;
// }
//
// }
//
// /* while (!fase1_zerada)
// {*/
// if (fase02->Executar(player, &player2, window, view, &two_players))
// {
// fase1_zerada = true;
// if (fase02->Executar(player, &player2, window, view, &two_players))
// printf("You win!\n");
// }
// else
// {
// printf("You died :(!\n");
// player = new Jogador(&playerTexture, sf::Vector2u(3, 9), 0.3f, 100.0f, 5, 1, 0, 200.f, 1);
// player2 = new Jogador(&player2Texture, sf::Vector2u(3, 9), 0.3f, 100.0f, 5, 1, 1, 200.f, 1);
// player2->setUnspawned();
// }
//
// //}
//
//
// }
//
//}
2 changes: 1 addition & 1 deletion Excalibur/Jogo.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Jogo
sf::Clock clock;
float deltaTime;
bool two_players;
sf::Event evnt; //verificar
sf::Event evnt;

};

30 changes: 16 additions & 14 deletions Excalibur/Menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,31 @@ Menu::Menu(float width, float height)
menu[0].setFillColor(sf::Color::Red);
menu[0].setString("Jogar modo continuo");
menu[0].setPosition(sf::Vector2f(width / 2, height / (MAX_NUMBER_OF_ITEMS + 1) * 1));
menu[0].setCharacterSize(20);//adicionei isso
menu[0].setCharacterSize(20);

menu[1].setFont(font);
menu[1].setFillColor(sf::Color::White);
menu[1].setString("Pular direto para fase 2");
menu[1].setPosition(sf::Vector2f(width / 2, height / (MAX_NUMBER_OF_ITEMS + 1) * 2));
menu[1].setCharacterSize(20);//adicionei isso
menu[1].setCharacterSize(20);

menu[2].setFont(font);
menu[2].setFillColor(sf::Color::White);
menu[2].setString("Sair");
menu[2].setPosition(sf::Vector2f(width / 2, height / (MAX_NUMBER_OF_ITEMS + 1) * 3));
menu[2].setCharacterSize(20);//adicionei isso
menu[2].setCharacterSize(20);

pausar.setString("Para pausar aperte ESC"); //adicionei isso daqui no menu pra falar como pausar //adicionei isso
pausar.setFont(font);//adicionei isso
pausar.setFillColor(sf::Color::Yellow);//adicionei isso
pausar.setPosition(sf::Vector2f(width / 2, height / (MAX_NUMBER_OF_ITEMS + 1) * 4));//adicionei isso
pausar.setCharacterSize(14);//adicionei isso//adicionei isso
pausar.setString("Para pausar aperte ESC");
pausar.setFont(font);
pausar.setFillColor(sf::Color::Yellow);
pausar.setPosition(sf::Vector2f(width / 2, height / (MAX_NUMBER_OF_ITEMS + 1) * 4));
pausar.setCharacterSize(14);

continuar.setString("Para continuar aperte F5"); //e como despausar//adicionei isso
continuar.setFont(font);//adicionei isso
continuar.setFillColor(sf::Color::Yellow);//adicionei isso
continuar.setPosition(sf::Vector2f(width / 2, height / (MAX_NUMBER_OF_ITEMS + 1) * 5));//adicionei isso
continuar.setCharacterSize(14); //função para colocar o tamanho da letra//adicionei isso
continuar.setString("Para continuar aperte F5");
continuar.setFont(font);
continuar.setFillColor(sf::Color::Yellow);
continuar.setPosition(sf::Vector2f(width / 2, height / (MAX_NUMBER_OF_ITEMS + 1) * 5));
continuar.setCharacterSize(14);

selectedItemIndex = 0;
}
Expand All @@ -54,6 +54,8 @@ void Menu::Draw(sf::RenderWindow &window)
{
window.draw(menu[i]);
}
window.draw(pausar);
window.draw(continuar);
}

void Menu::MoveUp()
Expand All @@ -68,7 +70,7 @@ void Menu::MoveUp()

void Menu::MoveDown()
{
if (selectedItemIndex + 1 < MAX_NUMBER_OF_ITEMS)
if (selectedItemIndex + 1 < 3)
{
menu[selectedItemIndex].setFillColor(sf::Color::White);
selectedItemIndex++;
Expand Down
8 changes: 3 additions & 5 deletions Excalibur/Menu.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#pragma once
#include <SFML/Graphics.hpp>

#define MAX_NUMBER_OF_ITEMS 3

//Esse é o básico do menu. Podemos adicionar ainda mais alguns itens caso seja necessário.
#define MAX_NUMBER_OF_ITEMS 5

class Menu
{
Expand All @@ -20,7 +18,7 @@ class Menu
int selectedItemIndex;
sf::Font font;
sf::Text menu[MAX_NUMBER_OF_ITEMS];
sf::Text pausar; //adicionei isso
sf::Text continuar; //adicionei isso
sf::Text pausar;
sf::Text continuar;
};

2 changes: 1 addition & 1 deletion Excalibur/Obstaculo.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Obstaculo :
Obstaculo(sf::Texture* texture, sf::Vector2f size, sf::Vector2f position, int dano);
~Obstaculo();
const int getDano() { return dano; }
//verificar


protected:
int dano;
Expand Down
18 changes: 9 additions & 9 deletions Excalibur/Personagem.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ class Personagem
Personagem(sf::Texture* texture, sf::Vector2u imageCount, float switchTime, float speed, int health, int attack, int id);
virtual ~Personagem();

virtual void Update(float deltaTime) = 0; //declarada em inimigo / personagem
virtual void Draw(sf::RenderWindow &window) = 0; //declarada em inimigo / personagem
virtual void OnCollision(sf::Vector2f direcao) = 0; //declarada em inimigo / personagem
virtual void Update(float deltaTime) = 0;
virtual void Draw(sf::RenderWindow &window) = 0;
virtual void OnCollision(sf::Vector2f direcao) = 0;
virtual void ColidiuPersonagem(sf::Vector2f direcao, int dano) = 0;
void SetVelocidade(float x, float y) { velocidade.x = x; velocidade.y = y; }
void SetPosition(float x, float y) { body.setPosition(x, y); }
sf::Vector2f GetPosition() { return body.getPosition(); } //não sei se serão virtual tb
Colisor GetCollider() { return Colisor(body); } //não sei se serão virtual tb
sf::Vector2f GetPosition() { return body.getPosition(); }
Colisor GetCollider() { return Colisor(body); }
int getAttack() { return attack; }
virtual void setVida(int danoRecebido) { health -= danoRecebido; };

Expand All @@ -28,10 +28,10 @@ class Personagem
int health;
int attack;
int id;
sf::RectangleShape body; //personagem
Animacao animacao; //personagem
unsigned int row; //personagem
bool faceRight; //personagem
sf::RectangleShape body;
Animacao animacao;
unsigned int row;
bool faceRight;
sf::Vector2f velocidade;
sf::Vector2f posicao;

Expand Down
Loading

0 comments on commit c635b33

Please sign in to comment.