Skip to content

Commit

Permalink
MDR ca mareche les annimationk c'est surfé
Browse files Browse the repository at this point in the history
  • Loading branch information
GitWatin committed May 13, 2020
1 parent c98760c commit 4429797
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
18 changes: 12 additions & 6 deletions SmashBigBordelv2/Jeu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ Jeu :: ~Jeu()
Entite *jeu;
jeu = new Entite();
delete jeu;
delete clock_Depart;
delete clock_HUD;
delete clock_jeu;
delete clock_Move;
// Destructeur HUD
for (int i = 0; i < vectorHUD.size(); i++)
{
Expand Down Expand Up @@ -114,12 +118,12 @@ void Jeu::CheckModif()
if (perso1choisi->getMoveRight()) //check si le bool est actif
{

Animate(perso1choisi, "droite");
Animate(perso1choisi, "droite",1);
perso1choisi->move(dureeIteration.asSeconds()*((VitesseDeplacement / perso1choisi->GetPoids()) * VitesseDeplacement), 0);
}
if (perso1choisi->getMoveLeft()) //check si le bool est actif
{
Animate(perso1choisi, "gauche");
Animate(perso1choisi, "gauche",1);
perso1choisi->move(-dureeIteration.asSeconds()*((VitesseDeplacement / perso1choisi->GetPoids()) * VitesseDeplacement), 0);
}
if (perso1choisi->getJump()/*&& perso1choisi->getCollision()*/)
Expand All @@ -133,12 +137,12 @@ void Jeu::CheckModif()
//----------J2--------------------------------
if (perso2choisi->getMoveRight()) //check si le bool est actif
{
Animate(perso2choisi, "droite");
Animate(perso2choisi, "droite",2);
perso2choisi->move(dureeIteration.asSeconds()*((VitesseDeplacement / perso2choisi->GetPoids()) * VitesseDeplacement), 0);
}
if (perso2choisi->getMoveLeft()) //check si le bool est actif
{
Animate(perso2choisi, "gauche");
Animate(perso2choisi, "gauche",3);
perso2choisi->move(-dureeIteration.asSeconds()*((VitesseDeplacement / perso2choisi->GetPoids()) * VitesseDeplacement), 0);
}
if (perso2choisi->getJump() /*&& perso2choisi->getCollision()*/)
Expand Down Expand Up @@ -230,9 +234,11 @@ bool Jeu::CheckCollision(Entite *michel,Entite *plateforme,float repoussement)
}*/


void Jeu::Animate(Personnage *perso, std::string direction)
void Jeu::Animate(Personnage *perso, std::string direction,int NumPerso)
{



TextureManager *texture_move;
texture_move= new TextureManager();
NomTextureMove = perso->GetAvatar();
Expand Down Expand Up @@ -273,7 +279,7 @@ void Jeu::Animate(Personnage *perso, std::string direction)
this->Iteration = 0;
}
delete texture_move;

}

void Jeu::CallModif()
Expand Down
6 changes: 5 additions & 1 deletion SmashBigBordelv2/Jeu.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Jeu
virtual void ChoixMap();
virtual void ChoixPerso();

virtual void Animate(Personnage *perso, std::string direction);
virtual void Animate(Personnage *perso, std::string direction,int NumPerso);

void CheckCollision(Personnage *michel);

Expand Down Expand Up @@ -118,6 +118,10 @@ class Jeu
int Iteration;
int Iteration2;
int sens;

int LastTimePerso1;
int LastTimePerso2;

std::string NomTextureMove;
// Variable état jeu if false = jeu terminé
bool Game_State = true;
Expand Down
1 change: 1 addition & 0 deletions SmashBigBordelv2/Morty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Morty::Morty(int x, int y) : Personnage()
this->SetNom("Morty");
this->SetAvatar("morty"); // Avatar de l'HUD
this->SetPathTexture("morty0.png");
this->LastTime = 0;

this->setTexture(*t->SetTexture(this->GetPathTexture()));
this->setTextureRect(sf::IntRect(0, 0, 78, 110));
Expand Down
4 changes: 3 additions & 1 deletion SmashBigBordelv2/Personnage.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Personnage :
virtual void setMoveLeft(bool ok);
virtual void setJump(bool ok);


float LastTime;

virtual bool getMoveRight();
virtual bool getMoveLeft();
Expand All @@ -47,6 +47,8 @@ class Personnage :
float Poids;
int Bouclier;



std::string NomSimple;
std::string DerniersAtout;
std::string TypeAttaque;
Expand Down

0 comments on commit 4429797

Please sign in to comment.