Hello,
I am looking to have an object swap frames on button press, and then swap back on button release. This is so I can visually represent the holding of the button.
Thanks,
Mono
Hello,
I am looking to have an object swap frames on button press, and then swap back on button release. This is so I can visually represent the holding of the button.
Thanks,
Mono
Hm… I think the problem here wouldn’t be the swap, but rather the detection of holding a button. There is no function/event for that afaik. When you hold a button in Pulp it triggers the action associated with it repeatedly at certain intervals.
Maybe a button hold can be detected by lowering config.inputRepeatDelay
and config.inputRepeatBetween
so the button triggers every frame. You’d then have to check every frame if the button is pressed and could detect a held button that way. Just a thought experiment, don’t know if it’ll actually work. It would also affect the rest of the game which is probably not desirable.
Hi, i think i found a solution for doing this. The only problem is, like said by Kucromy that it affects every input in the game because i used config.inputRepeatDelay and config.inputRepeatBetween. This isn't a problem for me because i'm only using one button for my game but maybe your game will be affected by it.
I also used an Any Event to reset a var as soon as the button is released. I think if you adapt a few things you can do what you want. Your trigger for a ReleaseEvent is if the Var APushTime has a value greater than 0. Hope this helps
I’m curious what the loop
+ wait
is intended to do. That creates a new 1 second long timer, every frame, 20 frames per second. So Time
isn’t updated for the first second of the game. After which, assuming accumulated precision issues don’t result in a missed frame, Time
is effectively updated (and shake
restarted) every frame. Why use the wait
at all?
ah my bad, i first tried to have the wait and add 1 to Time every sec but it didn't worked (i propably don't understand how the wait or loop event works yet) so i divide the time to add by the number of frame per second. And sinced it worked like that i forgot to remove it. But i'm wondering now because when i remove the wait the timer and the shake are broken.
So changing:
on loop do
wait 1 then
Time += 0.05
shake 0.1
end
end
to just:
on loop do
Time += 0.05
shake 0.1
end
doesn’t work?
loop
is called on every frame (so 20 times a second). wait x
will wait x
seconds before performing the actions inside its then ... end
block.
Thanks for the precision Actually removing the wait works fine for the Timer but i thought it didn't because the shake doesn't loop and only play once at start
Oh i just realized the script wasn't actually working because i forgot to reset AHold and reset it in the any event like i thought doesn't really works
From what I can tell is inputRepeat isn't supported on the A/B buttons. Does anyone else have any other solutions?
I'm pretty certain there is no way of detecting held A/B presses in pulp, unfortunately!