I wonder if there’s a feature to give keys a priority, e.g. in a list of movements as UP, DOWN, LEFT, RIGHT, when UP is active the character moves up and other keys don’t be activated when pressed while UP is pressed; when DOWN is pressed, the character moves down and LEFT, RIGHT don’t work while DOWN is pressed, but when UP is pressed, UP prevail on DOWN, and so on.
Also, I would like to ask if is possible make the last key pressed the one that prevails on the previous pressed.
If you want to only allow 1 key to trigger events you can add a Boolean like KeyPressed.
Set KeyPressed = false
"Up" keypressed set KeyPressed=true
KeyPress = false set KeyPressed=true
I just noticed I used [trigger once] out of habit. If you’re using the keys as controls, you might need them.
Thanks for the reply.
My question is more focused on the possibility to set a custom priority, especially for directions.
P.S.: I’ve changed the title of this thread in a more clear way.
Ok. I think I understand now. It would probably require the use of a Boolean or other variables. I have no idea at the moment. I’m not at my PC.
How is the player being moved? What style is it? Topdown, platform …
Top-down, 4 directions, RPG. Not using the Top-down movement Behaviour but the Grid Based Movement from GitHub: New extension: Grid Based Movement by github-actions[bot] · Pull Request #665 · GDevelopApp/GDevelop-extensions · GitHub
Here my Events:
Sorry, I’m not familiar with that extension.
No worries, thanks for your time
I’ve found the solution: instead of using a pre-build behaviour, I’ve used the old fashion variables.
Here my solution (it shows only one key but I’ve used it for all the four directions):
In this way my character doesn’t face any other direction when one is performing because all the other key don’t work until the step is over.
I’ll sign this topic al solved.
I’m glad it’s working. It kind of looks like you went binary. I could be wrong. I went all binary for a pipe puzzle project that I’ve been messing with. I wish Gdevelop was more binary friendly but I understand if they want to keep it simpler. Since the pipe pieces have 4 possible connectors, a 4-bit binary seemed like a perfect fit. Each bit represents an opening.
Edit: actually, I think I read your code wrong. I thought I was looking at the same variable being 1 or 16.
I’m not used with puzzle games, so I’m dreadful sorry if I cannot understand how to connect two different objects in 4 different ways. Did you already ask for a help in this community?
Sorry, it wasn’t a question. I was saying that’s how I did it. Thanks anyway.