Download

create button mashing mechanic?

How would I create a button mashing mechanic using blueprint in UE4 ?

Basically I want the play to key press the space bar for the door to open

Thanks !

Not sure what you want

a) press space bar to open door.
Just go to an empty area, right click & type input, & find space in the list to make a Input Event on Spacebar press/or release.
The tricky part you need to think about is which blueprint to have the input event, on your character, or the door, or something else.

b) Open the door by keep hitting space bar. Firstly, the spacebar isn’t design for this, bt if you insist, do the same as A,
then a possiility is to have a Integer counter variable that keep track how many time you hit spacebar, & maybe a timer to check interval between press.

What type of mashing mechanic are you thinking of? I like those where you have a progress bar that has constant value to decrease its value to 0, each time you press the button you increase the value of the bar. The user achieves the action when the bar reaches a specific threshold.

This is easy to implement, just use a float value. In you tick you check the bounds of the value and if the game is still in progress you decrease the it using the current delta seconds and a specific time (the decrease will then be in speed/second). You then just add a button release event which increments the value using the same principal Value = Value + DeltaSeconds * Speed. You can tweak the increment and decrement speed to make it easier or more difficult.

Hope it helps :smiley:

Cheers,
Moss