# [Solved] Basic Programming Problema [:D]

E

##### Guest
Hello, lovely gamemakers

I wanted to check if the player is falling by creating this varaible: falling = (yprevious < y),

I'm drawing it on the screen to test it and it always returns 0.

I've been messing around with it:
falling = (y + yprevious), returns the expected value, let's say 1235
but,​
falling = (y - yprevious) returns 0
I also created a variable: veamos = (y == yprevious), which returns 1
So y and yprevious have the same value, even though the player is moving up and down the screen :/

M

#### maratae

##### Guest
Well, assuming y and yprevious do their job, you can achieve what you want with:
Code:
``````if (y > yprevious)
{
falling = true;
}
else
{
falling = false;
}``````
Or the simplest version, since the (y > yprevious) comparison returns a boolean:
Code:
``falling = (y > yprevious);``

E

##### Guest
I'm using GM1.4.1772

I did as you said, and it still returns 0.

Weird. I belive y is being equal to yprevious

M

#### maratae

##### Guest
I'm using GM1.4.1772

I did as you said, and it still returns 0.

Weird. I belive y is being equal to yprevious
Are you using that comparison on the step event?

E

##### Guest
Yes. I tried in the Begin Step and in the End Step too, but they still appear to have the same value

##### Member
You could also try checking if the vertical speed is greater 0. I don't know if you're using in-built ones or custom movement variables, but the check remains the same.

E

##### Guest
I'm working in End Step now. Where y - yprevious is different than 0, but the variable falling still returns false

M

#### maratae

##### Guest
I'm working in End Step now. Where y - yprevious is different than 0, but the variable falling still returns false

E