# How create a combination keys?

## Recommended Posts

i have a Sprite2D control, created by me. on it i have 1 timer(10ms), always enabled, for the keyboard events.

my problem is: how can i combinate the keys?

when we press 2 keys, that's natural if there is a little delay between the 1st and 2nd key. how can i avoid\detect these delay?

i'm creating the jump method. but the jump can be just up and down or for left or right. the jump up and down works fine, but the directional just sometimes

##### Share on other sites
Perhaps have a small delay before processing the key press event to optionally detect combo key presses/key holds? Or you can start and action, detect a change during the animation sequence and morph the action into another?

For instance, if your sprite has only begun moving and you detect a jump command within a small window of time, switch/morph/override your action into a forward jump. In my game whenever I detect a jump press, I check to see if the character is standing or moving, if he is moving I queue a moving jump otherwise I queue a standing jump.

##### Share on other sites

imagine if we have a little plataform, that the only way to move is jump to left or right. sometimes, my combination keys can fail

##### Share on other sites

i found my bug:

Public Sub Jump(ByVal height As Integer, Optional ByRef direction As Integer = 0, Optional ByVal ToDownPlataform As Boolean = False)
intJump = CInt(height / 2)
intJumpLeft = direction
If intJump > 0 Then tmrGravidadeSalto.Start()
End Sub


before the 'if' was for 'exit sub'. so i losed the 'direction'.

thanks for all

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628686
• Total Posts
2984232

• 14
• 13
• 13
• 10
• 10