scrip nouveau monstre completr

This commit is contained in:
suruq 2016-06-15 17:47:10 +02:00
parent 16cf918d13
commit 1a5fcc223f
3 changed files with 24 additions and 29 deletions

View File

@ -112,59 +112,39 @@
const unsigned char SacPV0[]={0xff, 0xc7, 0xd7, 0x83, 0xbb, 0x83, 0xff, 0xff, };
const unsigned char SacPV1[]={0xff, 0xc7, 0xd7, 0x83, 0xbb, 0x83, 0xff, 0xff, };
const unsigned char SacPV2[]={0xff, 0xc7, 0xd7, 0x83, 0xbb, 0x83, 0xff, 0xff, };
const unsigned char SacPV3[]={0xff, 0xc7, 0xc7, 0x83, 0x83, 0x83, 0xff, 0xff, };
const unsigned char SacPV4[]={0xff, 0xc7, 0xc7, 0x83, 0x83, 0x83, 0xff, 0xff, };
const unsigned char SacPV5[]={0xff, 0xc7, 0xc7, 0x83, 0x83, 0x83, 0xff, 0xff, };
const unsigned char SacPV6[]={0xff, 0xc7, 0xc7, 0x8b, 0x83, 0x83, 0xff, 0xff, };
const unsigned char SacPV7[]={0xff, 0xc7, 0xc7, 0x8b, 0x83, 0x83, 0xff, 0xff, };
const unsigned char SacPV8[]={0xff, 0xc7, 0xc7, 0x8b, 0x83, 0x83, 0xff, 0xff, };
const unsigned char SacPV0_n[]={0x38, 0x7c, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6c, };
const unsigned char SacPV1_n[]={0x38, 0x7c, 0xff, 0xff, 0xff, 0xff, 0xff, 0x60, };
const unsigned char SacPV2_n[]={0x39, 0x7d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xd, };
const unsigned char SacPV3_n[]={0x38, 0x7c, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6c, };
const unsigned char SacPV4_n[]={0x38, 0x7c, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc, };
const unsigned char SacPV5_n[]={0x39, 0x7d, 0xff, 0xff, 0xff, 0xff, 0xff, 0x61, };
const unsigned char SacPV6_n[]={0x38, 0x7c, 0xff, 0xff, 0xff, 0xff, 0xff, 0x38, };
const unsigned char SacPV7_n[]={0x38, 0x7c, 0xff, 0xff, 0xff, 0xff, 0xff, 0x2c, };
const unsigned char SacPV8_n[]={0x39, 0x7d, 0xff, 0xff, 0xff, 0xff, 0xff, 0x35, };
Sprite S_SacPV0 (SacPV0,SacPV0_n ,7,8);
Sprite S_SacPV1 (SacPV1, SacPV1_n,7,8);
Sprite S_SacPV2 (SacPV2, SacPV2_n,7,8);
Sprite S_SacPV3 (SacPV3, SacPV3_n,7,8);
Sprite S_SacPV4 (SacPV4,SacPV4_n ,7,8);
Sprite S_SacPV5 (SacPV5, SacPV5_n,7,8);
Sprite S_SacPV6 (SacPV6,SacPV6_n ,7,8);S_SacPV6.CreateReverse();
Sprite S_SacPV7 (SacPV7,SacPV7_n ,7,8);S_SacPV7.CreateReverse();
Sprite S_SacPV8 (SacPV8,SacPV8_n ,7,8);S_SacPV8.CreateReverse();
Sprite S_Sac_avant[]={S_SacPV0,S_SacPV1,S_SacPV2};
Sprite S_Sac_arriere[]={S_SacPV3,S_SacPV4,S_SacPV5};
Sprite S_Sac_cote[]={S_SacPV6,S_SacPV7,S_SacPV8};
Animation A_Sac_avant(S_Sac_avant,3,200);
Animation A_Sac_arriere(S_Sac_arriere,3,200);
Animation A_Sac_cote(S_Sac_cote,3,200);
Animation A_Sac_avant(S_SacPV0);
Animation A_Sac_arriere(S_SacPV3);
Animation A_Sac_cote(S_SacPV6);
Animation A_SacPV[]={A_Sac_avant,A_Sac_arriere,A_Sac_cote};

View File

@ -35,15 +35,30 @@ void IaSlime::Update()
void IaSacPV::Start()
{
GetObject()->AddRigidBody();
int vie=5;
Direction = 0;
}
void IaSacPV::UpdateEverySecond()
{
Direction = rand_int_ab(1, 5);
switch(Direction)
{
case 1 : GetObject()->GetRigidBody()->Move(0,3);GetObject()->GetRender()->SetIt(1);break;
case 4 : GetObject()->GetRigidBody()->Move(3,0);GetObject()->GetRender()->SetIt(2);GetObject()->GetRender()->ReverseRender(true); break;
case 3 : GetObject()->GetRigidBody()->Move(0,-3);GetObject()->GetRender()->SetIt(0);break;
case 2 : GetObject()->GetRigidBody()->Move(-3,0);GetObject()->GetRender()->SetIt(2);GetObject()->GetRender()->ReverseRender(false); break;
}
}
void IaSacPV::Update()
{
if(GetObject()->GetCollisionTag("Epee"))
{
vie--;
}
if (vie<=0)GetEngine()->DelObject(GetObject());
}

View File

@ -23,7 +23,7 @@ class IaSacPV: public Script
void Start();
void UpdateEverySecond();
void Update();
int vie;
int Direction;
};