How create a combination keys?

Started by
2 comments, last by cambalinho 7 years ago

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

Advertisement
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.

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

i found my bug:


Public Sub Jump(ByVal height As Integer, Optional ByRef direction As Integer = 0, Optional ByVal ToDownPlataform As Boolean = False)
        If tmrGravidadeSalto.Enabled = False Then tmrGravidadeSalto.Enabled = True
        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

This topic is closed to new replies.

Advertisement