Browse Source

Ajout d'une transition lorsque l'on rentre ou sort des maisons

master
Fife 3 years ago
parent
commit
b7ae775419
3 changed files with 46 additions and 90 deletions
  1. 27
    22
      GoldQuest.cpp
  2. 18
    68
      Perso.cpp
  3. 1
    0
      Perso.hpp

+ 27
- 22
GoldQuest.cpp View File

@@ -74,14 +74,14 @@ int Jeu()

Level * world[]={mapPrincipal,maison1,maison2,maison3};

Object * Trigger1 = new Object; Trigger1->GetTransform()->SetXY(170,97); Trigger1->AddRigidBody();Trigger1->GetRigidBody()->UseFixeBody(10,2);Trigger1->AffectTag("T1");
Object * Trigger2 = new Object; Trigger2->GetTransform()->SetXY(30,1); Trigger2->AddRigidBody();Trigger2->GetRigidBody()->UseFixeBody(10,2);Trigger2->AffectTag("T2");
Object * Trigger3 = new Object; Trigger3->GetTransform()->SetXY(198,97); Trigger3->AddRigidBody();Trigger3->GetRigidBody()->UseFixeBody(10,2);Trigger3->AffectTag("T3");
Object * Trigger4 = new Object; Trigger4->GetTransform()->SetXY(170,1); Trigger4->AddRigidBody();Trigger4->GetRigidBody()->UseFixeBody(10,2);Trigger4->AffectTag("T4");
Object * Trigger5 = new Object; Trigger5->GetTransform()->SetXY(58,83); Trigger5->AddRigidBody();Trigger5->GetRigidBody()->UseFixeBody(10,2);Trigger5->AffectTag("T5");
Object * Trigger6 = new Object; Trigger6->GetTransform()->SetXY(58,1); Trigger6->AddRigidBody();Trigger6->GetRigidBody()->UseFixeBody(10,2);Trigger6->AffectTag("T6");
Object * Trigger7 = new Object; Trigger7->GetTransform()->SetXY(72,125); Trigger7->AddRigidBody();Trigger7->GetRigidBody()->UseFixeBody(10,2);Trigger7->AffectTag("T7");
Object * Trigger8 = new Object; Trigger8->GetTransform()->SetXY(114,1); Trigger8->AddRigidBody();Trigger8->GetRigidBody()->UseFixeBody(10,2);Trigger8->AffectTag("T8");
Trigger * Trigger1 = new Trigger; Trigger1->CreateTrigger(170,97,10,2); Trigger1->SetDestination( 29 , 3 , 1 , "Perso");
Trigger * Trigger2 = new Trigger; Trigger2->CreateTrigger(30,1,10,2); Trigger2->SetDestination( 169 , 85 , 0 , "Perso");
Trigger * Trigger3 = new Trigger; Trigger3->CreateTrigger(198,97,10,2); Trigger3->SetDestination( 169 , 3 , 1 , "Perso");
Trigger * Trigger4 = new Trigger; Trigger4->CreateTrigger(170,1,10,2); Trigger4->SetDestination( 197 , 85 , 0 , "Perso");
Trigger * Trigger5 = new Trigger; Trigger5->CreateTrigger(58,83,10,2); Trigger5->SetDestination( 57 , 3 , 2 , "Perso");
Trigger * Trigger6 = new Trigger; Trigger6->CreateTrigger(58,1,10,2); Trigger6->SetDestination( 57 , 69 , 0 , "Perso");
Trigger * Trigger7 = new Trigger; Trigger7->CreateTrigger(72,125,10,2); Trigger7->SetDestination( 113 , 3 , 3 , "Perso");
Trigger * Trigger8 = new Trigger; Trigger8->CreateTrigger(114,1,10,2); Trigger8->SetDestination( 71 , 113 , 0 , "Perso");

//*************Moteur*************\\

@@ -106,6 +106,11 @@ int Jeu()
Game.AddObject(Trigger7,0);
Game.AddObject(Trigger8,3);

Game.SetCurrentLevel(0);

GUI * scriptGui = new GUI;
Game.AffectGui(scriptGui);

Game.StartGame();


@@ -114,26 +119,26 @@ int Jeu()

extern "C"
{
int AddIn_main(int isAppli, unsigned short OptionNum)
{
Jeu();
return 1;
}
#pragma section _BR_Size
int AddIn_main(int isAppli, unsigned short OptionNum)
{
Jeu();
return 1;
}
#pragma section _BR_Size


unsigned long BR_Size;
#pragma section
unsigned long BR_Size;
#pragma section


#pragma section _TOP
#pragma section _TOP

int InitializeSystem(int isAppli, unsigned short OptionNum)
{
return INIT_ADDIN_APPLICATION(isAppli, OptionNum);
}
int InitializeSystem(int isAppli, unsigned short OptionNum)
{
return INIT_ADDIN_APPLICATION(isAppli, OptionNum);
}

#pragma section
#pragma section
}



+ 18
- 68
Perso.cpp View File

@@ -13,15 +13,29 @@ void Control ::Start()
p_epee->AffectTag("Epee");
}

void Control::Teleport( int x , int y , int level )
{
GetEngine()->GetCurrentLevel()->DrawLevel();

for(int i = 0 ; i < 190 ; i ++)
{
ML_line(0,i,i,0,ML_BLACK);
ML_display_vram();
Sleep(3);
}

GetEngine()->MoveObject(GetObject(),level);
GetEngine()->MoveObject(p_epee,level);
GetEngine()->SetCurrentLevel(level);
GetObject()->GetTransform()->SetXY(x,y);
}

void Control::Update()
{
BarreVie=Vie*40/VieMax;
ML_line (126,40,126,40-BarreVie,ML_BLACK);
ML_line (125,1,125,41,ML_BLACK);
ML_line (127,1,127,42,ML_BLACK);
ML_line (125,1,127,1,ML_BLACK);
ML_line (125,41,127,41,ML_BLACK);

ML_rectangle(125,1,127,42,1,ML_BLACK,ML_BLACK);

Object * Buffer = GetObject()->GetObjectCollisionTag("Slime");
if(Buffer != NULL)
@@ -107,70 +121,6 @@ if(Buffer != NULL)
}
}

if(GetObject()->GetCollisionTag("T1"))
{
GetEngine()->MoveObject(GetObject(),1);
GetEngine()->MoveObject(p_epee,1);
GetEngine()->SetCurrentLevel(1);
GetObject()->GetTransform()->SetXY(29,3);
}

if(GetObject()->GetCollisionTag("T2"))
{
GetEngine()->MoveObject(GetObject(),0);
GetEngine()->MoveObject(p_epee,0);
GetEngine()->SetCurrentLevel(0);
GetObject()->GetTransform()->SetXY(169,86);
}

if(GetObject()->GetCollisionTag("T3"))
{
GetEngine()->MoveObject(GetObject(),1);
GetEngine()->MoveObject(p_epee,1);
GetEngine()->SetCurrentLevel(1);
GetObject()->GetTransform()->SetXY(169,3);
}

if(GetObject()->GetCollisionTag("T4"))
{
GetEngine()->MoveObject(GetObject(),0);
GetEngine()->MoveObject(p_epee,0);
GetEngine()->SetCurrentLevel(0);
GetObject()->GetTransform()->SetXY(197,86);
}

if(GetObject()->GetCollisionTag("T5"))
{
GetEngine()->MoveObject(GetObject(),2);
GetEngine()->MoveObject(p_epee,2);
GetEngine()->SetCurrentLevel(2);
GetObject()->GetTransform()->SetXY(57,3);
}

if(GetObject()->GetCollisionTag("T6"))
{
GetEngine()->MoveObject(GetObject(),0);
GetEngine()->MoveObject(p_epee,0);
GetEngine()->SetCurrentLevel(0);
GetObject()->GetTransform()->SetXY(57,69);
}

if(GetObject()->GetCollisionTag("T7"))
{
GetEngine()->MoveObject(GetObject(),3);
GetEngine()->MoveObject(p_epee,3);
GetEngine()->SetCurrentLevel(3);
GetObject()->GetTransform()->SetXY(113,3);
}

if(GetObject()->GetCollisionTag("T8"))
{
GetEngine()->MoveObject(GetObject(),0);
GetEngine()->MoveObject(p_epee,0);
GetEngine()->SetCurrentLevel(0);
GetObject()->GetTransform()->SetXY(71,113);
}

if (input_press(K_EXIT))GetEngine()->StopGame();

GetEngine()->MiddleScreen(GetObject()->GetTransform()->GetX() + 6 , GetObject()->GetTransform()->GetY() + 6);

+ 1
- 0
Perso.hpp View File

@@ -12,6 +12,7 @@ class Control: public Script

void Start();
void Update();
void Teleport( int x , int y , int level );


GUI * S_GUI;

Loading…
Cancel
Save