You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

64 lines
1.7 KiB

#include "..\C-Engine\CEngine.hpp"
#include "monstres.hpp"
void IaSlime::Start()
{
GetObject()->AddRigidBody();
Direction = 0;
}
void IaSlime::UpdateEverySecond()
{
Direction = rand_int_ab(1, 5);
switch(Direction)
{
case 1 : GetObject()->GetRigidBody()->Move(0,3);GetObject()->GetRender()->SetIt(1);break;
case 2 : 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 4 : GetObject()->GetRigidBody()->Move(-3,0);GetObject()->GetRender()->SetIt(2);GetObject()->GetRender()->ReverseRender(false); break;
}
}
void IaSlime::Update()
{
if(GetObject()->GetCollisionTag("Epee"))
{
GetEngine()->DelObject(GetObject());
}
}
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());
}