Simple System for Key Combinations

Yesteday afternoon I though about a way to input key combinations in Gdevelop, so even if you use just 2 buttons and the arrow keys, you could do something more than attack, attack, attack combos.

This is the second try for it. It detects a few key combinations like the traditional Down, Foward, Attack (Named Hadoken), even doing it mid air.

It isn’t perfect, but it may be a way to start for someone (Personally, I’d love to use it in my next game)

(The way to make the moves is in the comments in the events’ sheet)


Ayer por la tarde pensé en una manera de introducir combinaciones de teclas en Gdevelop, de manera que, aún si usas solo 2 botones y las teclas de dirección, puedas hacer algo más que solo combos de ataque, ataque, ataque.

Éste es el segundo intento de hacerlo. Detecta algunas combinaciones de teclas como el tradicional Abajo, Adelante, Ataque (Llamado Hadoken), aún si estás en el aire.

No es perfecto, pero puede ser una forma de empezar para alguien (Personalmente, me gustaría usarlo en mi siguiente juego)

(La forma de hacer los movimientos se encuentra en los comentarios en la pantalla de eventos)

https://drive.google.com/file/d/1-m3lkPhT3KXHQop6uP-WYYwnyPPvrChE/view?usp=sharing

There is an extension called “Konami”. Maybe another name would help users find it. :confused:

I saw the Konami extension and works great, but how do I set up multiple key inputs?
Lets say the Hadoken (down, forward, attack) and the ShoRyuKen (forward, down, forward, attack) so my character can do both.

A short video showing some of the moves I have setup for detection. It isn’t anything near to perfection, yet it may be useful for someone trying to make key combinations available for their games.

Sorry about the video delays. My pc wasn’t able to do a fluid screen capture.

Un video corto mostrando algunos de los movimientos que configuré para ser detectados. No está ni cerca de ser perfecto, pero podría serle útil a alguien que intente tener combinaciones de teclas dsiponibles en sus juegos.

Una disculpa por los cortes. Mi computadora no pudo hacer una captura de pantalla fluida.

1 Like

I did a third version of the code. Now the jump nor the “attack” button (A key) cut the inputs. You can see the number growing up to 11 keys. Why 11 keys… it is the lenght of the Konami Kode… and yes, I did it so I can input the Konami Code too, and still being able to detect the other inputs.

The detected keys are put in a growing number, said number is divided by 100000000000 and the mod is taken (Limit). I do a repeat while the detected number is over 9 (meaning it is a single key, so ignored) and it is compared to my defined values for each move. If it isn’t equal, then I divide the max number by 10 and the cycle goes again.

When a valid key combination is found, then the detection value is set to 0, so the same key combination is not detected.

It works really nice and the key combinations aren’t hard to config. 1 for up, 2 for right, 3 down, 4 left, 5 jump, 6 attack. (I can still map 3 more buttons.)

If someone wants to take a peek.


Hice una tercer version del código. Ahora los botones de salto o ataque no cortan las entradas. Puedes ver un número crecer hasta 11 teclas. Por qué 11… es la longitud del Kódigo Konami… Y si, lo hice de tal manera que puedo poner el Kódigo Konami también, y aún ser capaz de detectar las otras entradas.

Los teclas detectadas son puestas en un número creciente, dicho número es dividido por 100000000000 y se toma el resto (Límite). Hago un repite mientras el número detectado es mayor que 9 (Eso sería una sola tecla, y se ignora) y se compara contra los valores definidos de cada movimiento. Si no es igual, se divide el número máximo entre 10 y el ciclo se repite.

Cuando se encuentra una combinación de teclas válida, entonces el valor de detección es puesto a 0, así no se vuelve a detectar una combinación de teclas.

Funciona muy bien y las combinaciones de teclas no son difíciles de configurar. 1 es arriba, 2 es derecha, 3 abajo, 4 izquierda, 5 salto, 6 ataque. (Aún puedo agregar 3 botones más.)

Si alguien desea mirar.

https://drive.google.com/file/d/1VcmiTM1WQPX8VfDtXxwgn-OHh4jPYydp/view?usp=sharing

1 Like

Mixing ideas. The random maze generator and the key combinations. I think it could be fun and challenging to move around such a map. (Color codes will help me, hopefully, to put ladders or ropes to climb on vertical spaces).