moveDirection.x

So atm I have a “power up” that allows you to move during your jump. Without the power up your jump velocity is locked so you can’t control where you land. I have half of this working.

if(Input.GetKeyDown("d"))
{
	moveDirection.x = speed;
}

if(Input.GetKeyDown("a"))
{
	moveDirection.x = speed;
}

So the input of “d” works fine and you move to the right. What I need to do it make it so that the input “a” does left. But “z” is forward and “y” is up. So how would I do left? When “x” is right. Is there a way to do something like this?

if(Input.GetKeyDown("a"))
{
	moveDirection.-x = speed;
}

Problem is when you do that the “-” errors it. So how do I do the reverse of x?

I also tried something like these and it didn’t work.

if(Input.GetKeyDown("a"))
{
	moveDirection.x-(moveDirection.x+moveDirection.x) = speed;
}
if(Input.GetKeyDown("a"))
{
	moveDirection.x-(x+x) = speed;
}

Thanks for your help.

Just use “-speed”.

–Eric