StreetFighterII/StreetFighter.cpp

150 lines
2.6 KiB
C++

#include "..\C-Engine\CHeader.hpp"
class Control: public Script
{
public:
void Update();
};
void Control::Update()
{
bool isground = GetObject()->ORigibody->CollisionDecor(GetX(),GetY()-1);
bool isdo = false;
if(input_press(K_RIGHT))
{
Move(1,0);
SetIt(1);
isdo = true;
}
else if(input_press(K_LEFT))
{
Move(-1,0);
SetIt(2);
isdo = true;
}
else if(input_press(K_UP) && isground == true)
{
GetObject()->ORigibody->R_body.velocity.y = 50 ;
}
else if(input_press(K_SHIFT) && isground == false)
{
SetIt(12);
isdo = true;
}
else if(input_press(K_OPTN) && isground == false)
{
SetIt(13);
isdo = true;
}
else if(input_press(K_DOWN) && input_press(K_SHIFT))
{
SetIt(7);
isdo = true;
}
else if(input_press(K_DOWN) && input_press(K_OPTN))
{
SetIt(8);
isdo = true;
}
else if(input_press(K_DOWN) && input_press(K_VARS))
{
SetIt(9);
isdo = true;
}
else if(input_press(K_DOWN))
{
SetIt(6);
isdo = true;
}
else if(input_press(K_SHIFT))
{
SetIt(3);
isdo = true;
}
else if(input_press(K_OPTN))
{
SetIt(4);
isdo = true;
}
else if(input_press(K_VARS))
{
SetIt(5);
isdo = true;
}
if(isground == false)
{
if(GetObject()->ORender->GetIt() != 12 && GetObject()->ORender->GetIt() != 13) SetIt(11);
}
if(isdo != true && isground == true)SetIt(0);
}
int Jeu()
{
#include "Sources\Sprite.hpp" // Inclusion des sprites.
//*****************Creation des objects******************
Object Player1;
Player1.OTransforms->SetXY(50, 24);
Player1.ORender->SetRender(A_Ken , 14);
Player1.ORigibody = new Rigibody(&Player1);
Player1.ORigibody->SetMass(1);
Control ScriptControl;
Player1.AffectScript(ScriptControl);
//**************Assignation des objects************
Engine Game;
Game.AddObject( & Player1);
Map Niveau;
Niveau.SetMap(tileset , level , prop , 12 , 12 , 15 ,10);
Game.AffectMap( &Niveau);
Niveau.AffectEngine( &Game);
Game.SetFpsWish(2);
Game.SetType(1);
Game.Game();
return 1;
}
extern "C"
{
int AddIn_main(int isAppli, unsigned short OptionNum)
{
Jeu();
return 1;
}
#pragma section _BR_Size
unsigned long BR_Size;
#pragma section
#pragma section _TOP
int InitializeSystem(int isAppli, unsigned short OptionNum)
{
return INIT_ADDIN_APPLICATION(isAppli, OptionNum);
}
#pragma section
}