I set 4 keys to move. And when I press up and their object moves normally. And when I press left and right, it also somehow moves up or down. And I don't understand what's wrong
Code:
FVector2D WSAD;
void ACamera::FMove(float Button)
{
int32 Key = Button;
switch(Key)
{
case 1:
if (WSAD.X != 1)
{
WSAD = FVector2D(0, 0);
WSAD.X = -1;
}
break;
case 2:
if (WSAD.X != -1)
{
WSAD = FVector2D(0, 0);
WSAD.X = 1;
}
break;
case 3:
if (WSAD.Y != -1)
{
WSAD = FVector2D(0, 0);
WSAD.Y = 1;
}
break;
case 4:
if (WSAD.Y != -1)
{
WSAD = FVector2D(0, 0);
WSAD.Y = -1;
}
break;
}
if (Player)
{
Player->DirectionMove = WSAD;
}
}
Aucun commentaire:
Enregistrer un commentaire