Jump to content
  • Advertisement
Sign in to follow this  
cambalinho

How create a combination keys?

This topic is 611 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
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.

Share this post


Link to post
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 this post


Link to post
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)
        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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!