Just like the title implies, sometimes (some builds) Input.pressed will fire whenever the checked key is pressed, and sometimes it won’t. Seems absolutely random. It’s also not the first time I’ve had this problem, so I suspect it’s not the project’s fault (though it may very well be).
Input.pressed not firing every time
jacobalbano
(Jacob Albano)
#3
I’ve had this problem myself, though I’m not sure what causes it. Some code would probably help, I guess? I assume you’re not doing anything too strange though.
miguelmurca
(Mike Evmm)
#4
Well, for instance, half-“borrowed” form the pink demo:
if (onSolid && Input.check("JUMP"))
{
spdY = JUMP;
onSolid = false;
spdX *= LEAP;
}
This only fires sometimes.
(Oh, and Merry Whatever-you-celebrate!)
jacobalbano
(Jacob Albano)
#5
Are you doing anything strange with your project? Framerate higher than 60, that kind of thing?
zachwlewis
(Zachary Lewis)
#7
A few things I instantly notice:
- This is using
Input.check()
, notInput.pressed()
. I’m sure this is obvious, butInput.pressed()
would never fire in this code, since it isn’t there. - If
onSolid
is false, the input check would not occur, since the conditional would perform an early-out. This would cause theInput.check()
function to not fire if the player is not on a solid object, which I also believe is the desired effect.
Are you expecting either of these cases to work differently?
miguelmurca
(Mike Evmm)
#8
- Yes, of course, that’s a typo, sorry.
- Well, this might be the issue. Every time I’ve faced this problem (usually with jumps, regular and wall-jumps) an extra condition is being checked. I’m thinking specifically of a wall jump case, in which
collide(x+1)||collide(x-1)
was being checked, along withInput.pressed("JUMP")
. I had to press the button twice or thrice to make the character jump, but it would jump eventually, making it odd that it was the value ofcollide
changing.