• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker how to have a keyboard_check_pressed function apply to only 1 thing at a time

O

OriginalGrim

Guest
This is a bug that I can't find a solution to, when I have let's say keyboard_check_pressed(ord("E")) being used as the button to talk to an npc but also to end the dialog box it just triggers the npc again and I think it's because when the var to tell the button to only do the one thing switches from true to false the game is immediately using the single moment I press E to do both the end dialog and the trigger dialog at the same time. Is there a way to make the game wait after the button is pressed before it can be triggered again?
 

NightFrost

Member
You also could create a dedicated object to read all your input devices and set variables accordingly, which then will be used by your other objects to check for player controls. You can then stop propagation like that by resetting a variable when necessary.
 

TheouAegis

Member
You also could create a dedicated object to read all your input devices and set variables accordingly, which then will be used by your other objects to check for player controls. You can then stop propagation like that by resetting a variable when necessary.
That would definitely be good for the shortcomings of io_clear() -- if you needed it only clear for one event type, or if you had an object that should always have access to the key (okay, that's a poor excuse), or if you have multiple key presses in which case io_clear() would erase all the key states.
 
Top