Download

Issues with holding down movement buttons via event timer + gates (blueprints provided)

Hey folks,

I’m working on something of a real-time grid-based game wherein players can move from tile to tile via basic up/down/left/right controls. Because I want to give players the option of holding down a directional input and to continue moving in that direction.
To facilitate this, I implemented a “set timer by event” node after EventBeginPlay, and then use said timer to enter gates and use respective directional keys to open them (see attached image).
This solution works quite well with the one annoying caveat that the player can end up not moving upon button press if it doesn’t coincide with the timer. Holding down the button gives the required behavior, but not necessarily pressing it.
I’ve fudged around with moving the “set timer” node around after the directional input is made, but it doesn’t seem to give the requisite behavior.

My second question is whether or not using the Sequence Gate after the Timer Event is totally kosher. I don’t exactly want to give precedence to any direction over another, but I do need a way to get that custom event to every gate. Any ideas?

I’m happy to provide more blueprints if necessary.

Create a bool for each direction and repeat movement as long as bool is true. You can then use the pressed/released part to control the bool itself.

Thank you for your response!

Doing a bool check on tick introduces a different but anticipated issue. First, I think I should explain that this grid based game uses a vector array for its positions, and just does some basic math/collision detection to find out whether or not the requested move is valid or not. By doing a bool check on tick, the player can basically move across the entire board in an instant, which is obviously undesirable behavior.

bc0a3ce48caa7a7521da75dd64e27dfe002fe8a5.png
fa941c9c46c1eb2f15162a6126e25bb362fb9cd9.png

I implemented some delays in attempt to curtail this behavior, but they also introduce strange behavior, wherein a player can still be moving a few extra spaces after having let go of the directional key.

caffa245435bc54a9e6b7f52753f25e926f4637b.png

For further reference, I have attached the blueprints for the interpolated movement of the pawn, perhaps changes can be made there?

actormovement.png

Thank you!