i’m using C#, and I was making code and I typed
//Null
if(DirectionX,DirectionY == 0)
{
Debug.Log("You are not pressing any movement buttons");
direction = Direction.None;
}
it says error about operator == cannot be applied to operands to type float and bool
I don’t think you can do this
if(DirectionX,DirectionY == 0)

it shoud be like this for OR…
if(DirectionX == 0 || DirectionY == 0)
…or like this for AND
if(DirectionX == 0 DirectionY == 0)
and this will check if those variables are zero, not null.
btw, what types are DirectionX and DirectionY ?
@tombali (thumbs up)
if it is float or double don’t use the equality operator instead try delta comparison to avoid precision errors.
if(Mathf.Abs(DirectionX) < 0.1f || Mathf.Abs(DirectionY) < 0.1f)
// no movement passed
you should probably use Mathf.Approximately to do float comparisions, or use <=,<,>,>= comparers
they are whatever type you define them as.
never thought of that, rarely hear of mathf
Direction X and Direction Y is the var I made, with stridervans help with the 8 axis
You reply to a thread about C# being unclean
http://puu.sh/2gNw7
but you don’t understand the basics of C#?
I think one needs to stop trolling.
I was not trolling, I was joking with a little truth in it, people are quick to say OMG C# is ugly and I don’t agree, I was joking implying that his very clean script, is by default ugly and can’t cleaned…most people got it, sorry you didn’t 