hey,
when I press A for left and then press W for up or S for down, the knight facing right istead of left.
i know the problem is in this segment in the code but how do i fix it?
direction.x < 0.f ? rightLeft = -1.f : rightLeft = 1.f;
the whole segment is:
if (Vector2Length(direction) != 0.f)
{ /*Add to worldPos the result of scaling the
normalize “direction” vector by “speed”. */
worldPos = Vector2Add(worldPos, Vector2Scale(Vector2Normalize(direction), speed));
//check knight facing.
direction.x < 0.f ? rightLeft = -1.f : rightLeft = 1.f;
texture = run;
}
else
{
texture = idle;
}