Count steps only when move Y direction

Hi
This is my first post here, so sorry if it is in wrong thread.
i Am making game that is something like frogger. to achieve to higher score you must get upper on screen.
i Can make variable which checks Y position, but if player start down, he starting with 255 score and it goes up.
I am not too experienced with variables, but i think it cant be that hard.
Thanks for any help.
Think of y as reversed so as the payer goes up the y goes down and as the player goes down the y goes up. you could make a temp variable that is also set the the players initial y and then subtract the value of the initial y by the y of the player to get the diff.
Code:
//DO NOT CHANGE
let yTemp = $gamePlayer._y;
//This will set the value to 0 when the player spawns
let score = yTemp - $gamePlayer._y;
//on each step you would then have to update the variable
Think of y as reversed so as the payer goes up the y goes down and as the player goes down the y goes up
Thanks, i will try that tonight

Original thread: https://forums.rpgmakerweb.com/threads/count-steps-only-when-move-y-direction.135601/