*Originally posted by ahmed *
**that’s an interesting bit… do you mind explaining it?.. i just cant get it :beam: **
s is the variable the Key.isDown(Key.SPACE) is saved to, this happens every frame Obviously. This happens in the if statement… again, fairly apparent. When it happens is after the first “s-” so if Key.isDown(Key.SPACE) is not the same at that point in time, that s in hte “s-” still holds the value of the previous frame - this value being either true or false, which numerically is either 1 (true) or 0 (false). And since the first s is not the current s, we are subtracting the values of Key.isDown(Key.SPACE) for this frame and the previous frame where it was last set: Last frame Space is down minus current frame space is down. Since we want to know when the space bar is released, we want the previous frame to be true and the current frame to be false or true minus false. That is the same as 1-0 which is 1 which is greater than 0. If both are true, you get 1-1 which is 0 and not >0. Both false, 0-0, or 0 and not >0. And with 0-1 you get -1 which is also, not >0 (-1 is in the case of just pressing the space bar). So in the end the only thing greater than 0 is the releasing of space. You could also say ==1, but the > sign is one character and == is 2 SAVED TYPING!