Ajout du boss
This commit is contained in:
parent
ae1ba14757
commit
392f10f5ba
1
GUI.hpp
1
GUI.hpp
|
@ -14,6 +14,7 @@ class Script_GUI: public Script
|
|||
void DelVie(int v);
|
||||
int GetVie();
|
||||
void AddScore(int v);
|
||||
void EndStage();
|
||||
|
||||
void Lose();
|
||||
void TryAgain();
|
||||
|
|
|
@ -60,7 +60,7 @@ void Mob_Whispy::Update()
|
|||
Ia_Souffle * Buffer_Script = new Ia_Souffle;
|
||||
Buffer->AffectScript(Buffer_Script);
|
||||
|
||||
Buffer->GetTransform()->SetXY( GetX() - 16 , GetY() + 2);
|
||||
Buffer->GetTransform()->SetXY( GetX() - 4 , GetY() + 2);
|
||||
|
||||
Buffer->AddRigidBody();
|
||||
|
||||
|
@ -116,6 +116,18 @@ void Mob_Whispy::Update()
|
|||
choix = -1;
|
||||
SetIt(2);
|
||||
|
||||
Object * Buffer = new Object;
|
||||
|
||||
Ia_FS * Buffer_Script = new Ia_FS;
|
||||
Buffer->AffectScript(Buffer_Script);
|
||||
|
||||
Buffer->GetTransform()->SetXY( 50, 50 );
|
||||
Buffer->GetRender()->SetRender(A_FS);
|
||||
|
||||
Buffer->AffectTag("FS");
|
||||
|
||||
GetEngine()->AddObject(Buffer);
|
||||
|
||||
GetObject()->AffectTag(" ");
|
||||
}
|
||||
|
||||
|
@ -183,3 +195,17 @@ void Ia_Souffle::Update()
|
|||
|
||||
if(CollisionDecor( GetX() - 1, GetY() ) )GetEngine()->DelObject(GetObject());
|
||||
}
|
||||
|
||||
Ia_FS::Ia_FS()
|
||||
{
|
||||
time = 0;
|
||||
}
|
||||
|
||||
void Ia_FS::Update()
|
||||
{
|
||||
if(!time)GetObject()->GetRender()->SetDirection(GetObject()->GetRender()->GetDirection() + 45);
|
||||
|
||||
time ++;
|
||||
|
||||
if(time > 5)time = 0;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ class Mob_Whispy: public Mob
|
|||
|
||||
Animation A_Souffle;
|
||||
Animation A_Apple;
|
||||
Animation A_FS;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -44,10 +45,17 @@ class Ia_Souffle: public Script
|
|||
{
|
||||
public:
|
||||
|
||||
|
||||
void Update();
|
||||
|
||||
};
|
||||
|
||||
class Ia_FS: public Script
|
||||
{
|
||||
public:
|
||||
|
||||
Ia_FS();
|
||||
|
||||
void Update();
|
||||
int time;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -13,7 +13,7 @@ void Control::Start()
|
|||
isfull = 0;
|
||||
ishurt = 0;
|
||||
|
||||
compteur = 0;
|
||||
couldown = 0;
|
||||
|
||||
direction = 0;
|
||||
|
||||
|
@ -39,7 +39,7 @@ void Control::Teleport( int x , int y , int level )
|
|||
|
||||
for(int i = 0 ; i < 190 ; i ++)
|
||||
{
|
||||
ML_line(0,i,i,0,ML_BLACK);
|
||||
ML_line(-1,i,i,-1,ML_BLACK);
|
||||
ML_display_vram();
|
||||
Sleep(3);
|
||||
}
|
||||
|
@ -56,6 +56,8 @@ void Control::Teleport( int x , int y , int level )
|
|||
|
||||
void Control::Update()
|
||||
{
|
||||
if(couldown)couldown--;
|
||||
|
||||
boss = false;
|
||||
|
||||
for(int i = 0 ; i < GetEngine()->GetCurrentLevel()->GetNbObject() ; i++ )
|
||||
|
@ -111,7 +113,17 @@ void Control::Update()
|
|||
GetBody()->velocity.x = 0;
|
||||
GetBody()->velocity.y = 0;
|
||||
}
|
||||
|
||||
if(!mod(isnhit,3))
|
||||
{
|
||||
if(GetObject()->GetRender()->GetActivate())
|
||||
GetObject()->GetRender()->DeActivateRender();
|
||||
else
|
||||
GetObject()->GetRender()->ActivateRender();
|
||||
}
|
||||
|
||||
ishurt --;
|
||||
isnhit --;
|
||||
}
|
||||
else //Sinon le joueur peut le controller
|
||||
{
|
||||
|
@ -120,32 +132,56 @@ void Control::Update()
|
|||
|
||||
//Test de sui on touche un ennemi
|
||||
|
||||
if(isnhit > 0)
|
||||
{
|
||||
isnhit --;
|
||||
|
||||
if(!mod(isnhit,3))
|
||||
{
|
||||
if(GetObject()->GetRender()->GetActivate())
|
||||
GetObject()->GetRender()->DeActivateRender();
|
||||
else
|
||||
GetObject()->GetRender()->ActivateRender();
|
||||
}
|
||||
|
||||
if(!isnhit)GetObject()->GetRender()->ActivateRender();
|
||||
}
|
||||
|
||||
if(Ennemi)
|
||||
{
|
||||
GetEngine()->DelObject(Ennemi,true);
|
||||
|
||||
if(!isaspi)
|
||||
if(!isaspi && !isnhit)
|
||||
{
|
||||
isfull = 0;
|
||||
ishurt = 20;
|
||||
|
||||
Interface->AddScore(400);
|
||||
Interface->DelVie(1);
|
||||
|
||||
if(Interface->GetVie() == 6 )ishurt = 0;
|
||||
if(GetIt() != 12)
|
||||
{
|
||||
isfull = 0;
|
||||
ishurt = 20;
|
||||
isnhit = 80;
|
||||
|
||||
Interface->DelVie(1);
|
||||
|
||||
if(Interface->GetVie() == 6 )ishurt = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
isfull = 2;
|
||||
Interface->AddScore(200);
|
||||
if(isaspi)
|
||||
{
|
||||
isfull = 2;
|
||||
Interface->AddScore(200);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(Boss)
|
||||
if(Boss && !isnhit)
|
||||
{
|
||||
isfull = 0;
|
||||
ishurt = 20;
|
||||
isnhit = 80;
|
||||
|
||||
Interface->DelVie(1);
|
||||
|
||||
|
@ -189,33 +225,6 @@ void Control::Update()
|
|||
SSoufle * ScriptSouffle = new SSoufle;
|
||||
SStar * ScriptStar = new SStar;
|
||||
|
||||
switch(isfull)
|
||||
{
|
||||
case 1:
|
||||
delete ScriptStar;
|
||||
ScriptSouffle->time = 12;
|
||||
ScriptSouffle->Interface = Interface;
|
||||
Buffer->GetRender()->SetRender(RenderSouffle);
|
||||
Buffer->AffectScript(ScriptSouffle);
|
||||
|
||||
if(!direction)ScriptSouffle->direction = false;
|
||||
else ScriptSouffle->direction = true;
|
||||
break;
|
||||
case 2:
|
||||
delete ScriptSouffle;
|
||||
ScriptStar->Interface = Interface;
|
||||
Buffer->GetRender()->SetRender(RenderEtoile);
|
||||
Buffer->AffectScript(ScriptStar);
|
||||
Buffer->AddRigidBody();
|
||||
Buffer->AffectTag("Star");
|
||||
|
||||
if(!direction)ScriptStar->direction = false;
|
||||
else ScriptStar->direction = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
GetEngine()->AddObject(Buffer);
|
||||
|
||||
if(!direction)
|
||||
|
@ -229,6 +238,48 @@ void Control::Update()
|
|||
Buffer->GetRender()->ReverseRender(true);
|
||||
}
|
||||
|
||||
switch(isfull)
|
||||
{
|
||||
case 1:
|
||||
delete ScriptStar;
|
||||
|
||||
if(!couldown)
|
||||
{
|
||||
ScriptSouffle->time = 12;
|
||||
ScriptSouffle->Interface = Interface;
|
||||
Buffer->GetRender()->SetRender(RenderSouffle);
|
||||
Buffer->AffectScript(ScriptSouffle);
|
||||
|
||||
ScriptSouffle->direction = direction;
|
||||
|
||||
couldown = 25;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete ScriptSouffle;
|
||||
GetEngine()->DelObject(Buffer);
|
||||
}
|
||||
|
||||
break;
|
||||
case 2:
|
||||
delete ScriptSouffle;
|
||||
ScriptStar->Interface = Interface;
|
||||
Buffer->GetRender()->SetRender(RenderEtoile);
|
||||
Buffer->AffectScript(ScriptStar);
|
||||
Buffer->AddRigidBody();
|
||||
Buffer->AffectTag("Star");
|
||||
|
||||
ScriptStar->direction = direction;
|
||||
break;
|
||||
default:
|
||||
|
||||
delete ScriptStar;
|
||||
delete ScriptSouffle;
|
||||
GetEngine()->DelObject(Buffer);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
isfull = 0;
|
||||
isdo = true;
|
||||
|
||||
|
@ -344,6 +395,14 @@ void Control::Update()
|
|||
SetX(160);
|
||||
}
|
||||
|
||||
if(GetObject()->GetCollisionTag("FS"))
|
||||
{
|
||||
Interface->AddScore(1000);
|
||||
Interface->EndStage();
|
||||
}
|
||||
|
||||
if(!isfull && GetBody()->velocity.y < -40)SetIt(12);
|
||||
|
||||
GetEngine()->MiddleScreen( GetX() + 8 , GetY() + 10 );
|
||||
|
||||
}
|
||||
|
|
|
@ -61,6 +61,7 @@ class Control: public Script
|
|||
bool isaspi;
|
||||
int isfull;
|
||||
int ishurt;
|
||||
int isnhit;
|
||||
|
||||
bool direction; // Direction du personnage True = Gauche
|
||||
|
||||
|
@ -74,7 +75,7 @@ class Control: public Script
|
|||
|
||||
Script_GUI * Interface;
|
||||
|
||||
int compteur;
|
||||
int couldown;
|
||||
|
||||
bool boss;
|
||||
|
||||
|
|
29
Sprite.hpp
29
Sprite.hpp
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue