Sign in to follow this  

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


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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this