Pleurer en animation

This commit is contained in:
Claudel-D-Roy 2023-12-06 16:20:52 -05:00
parent 9924c12ccd
commit 89fafb100e

View File

@ -36,9 +36,9 @@ void RemotePlayer::Feed(const netprot::Output out) {
m_position = Vector3f(out.position);
m_direction = Vector3f(out.direction);
std::cout << "dead : " << out.states.dead << "hit :" << out.states.hit << "Jump :" << out.states.jumping << "JumpShot : " << out.states.jumpshot << "Running : " << out.states.running << "Shooting : " << out.states.shooting << "Still : " << out.states.still << std::endl;
std::cout << "Dead: " << out.states.dead << " Hit:" << out.states.hit << " Jump:" << out.states.jumping << " JumpShot: " << out.states.jumpshot << " Running: " << out.states.running << " Shooting: " << out.states.shooting << " Still: " << out.states.still << std::endl;
//std::cout << "powerUp " << out.states.powerup << std::endl;
current.states = out.states;
//current.position = out.position;
//current.direction = out.direction;
@ -120,24 +120,188 @@ void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, Transformation tr
angle = -angle;
Vector3f side = angleRemote.Cross(angleCam);
static bool Shooting = false;
bool isLeft = side.y > 0;
if (angle >= 0.75 ) //Face //side positif
index = 0;
if (angle >= 0.75) //Face //side positif
{
if(current.states.shooting){
if (Shooting)
index = 17;
else
index = 9;
}
else if (current.states.jumpshot) {
if (Shooting)
index = 41;
else
index = 33;
}
else if (current.states.jumping)
index = 25;
else if (current.states.running && current.states.still)
index = 0;
Shooting = !Shooting;
}
else if (angle >= 0.25 && isLeft) //Frontleft
index = 1;
{
if (current.states.shooting) {
if (Shooting)
index = 18;
else
index = 10;
}
else if (current.states.jumpshot) {
if (Shooting)
index = 42;
else
index = 34;
}
else if (current.states.jumping)
index = 26;
else if (current.states.running && current.states.still)
index = 1;
Shooting = !Shooting;
}
else if (angle >= -0.25 && isLeft) //ProfileLeft
index = 3;
{
if (current.states.shooting) {
if (Shooting)
index = 20;
else
index = 12;
}
else if (current.states.jumpshot) {
if (Shooting)
index = 44;
else
index = 36;
}
else if (current.states.jumping)
index = 28;
else if (current.states.running && current.states.still)
index = 3;
Shooting = !Shooting;
}
else if (angle >= -0.75 && isLeft) //BackLeft
index = 5;
{
if (current.states.shooting) {
if (Shooting)
index = 22;
else
index = 14;
}
else if (current.states.jumpshot) {
if (Shooting)
index = 46;
else
index = 38;
}
else if (current.states.jumping)
index = 30;
else if (current.states.running && current.states.still)
index = 5;
Shooting = !Shooting;
}
else if (angle < -0.75) //Dos //side négatif
index = 7;
{
if (current.states.shooting) {
if (Shooting)
index = 24;
else
index = 16;
}
else if (current.states.jumpshot) {
if (Shooting)
index = 48;
else
index = 40;
}
else if (current.states.jumping)
index = 32;
else if (current.states.running && current.states.still)
index = 7;
Shooting = !Shooting;
}
else if (angle >= 0.25 && !isLeft) //FrontRight
index = 2;
{
if (current.states.shooting) {
if (Shooting)
index = 19;
else
index = 11;
}
else if (current.states.jumpshot) {
if (Shooting)
index = 43;
else
index = 35;
}
else if (current.states.jumping)
index = 27;
else if (current.states.running && current.states.still)
index = 2;
Shooting = !Shooting;
}
else if (angle >= -0.25 && !isLeft) //ProfileRight
index = 4;
{
if (current.states.shooting) {
if (Shooting)
index = 21;
else
index = 13;
}
else if (current.states.jumpshot) {
if (Shooting)
index = 45;
else
index = 37;
}
else if (current.states.jumping)
index = 29;
else if (current.states.running && current.states.still)
index = 4;
Shooting = !Shooting;
}
else if (angle >= -0.75 && !isLeft) //BackRight
index = 6;
{
if (current.states.shooting) {
if (Shooting)
index = 23;
else
index = 15;
}
else if (current.states.jumpshot) {
if (Shooting)
index = 47;
else
index = 39;
}
else if (current.states.jumping)
index = 31;
else if (current.states.running && current.states.still)
index = 6;
Shooting = !Shooting;
}
float u, v, w, h;