• 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 get current key pressed?

S

Shadowblitz16

Guest
is there a way to get the currently pressed keyboard key by looping through keys?

something similar to what this does for the gamepad..
Code:
for ( var i = gp_face1; i < gp_axisrv; i++ ) 
{
    if ( gamepad_button_check( 0, i ) ) return i;
}
return false;
I don't want to use keyboard_lastkey because that would continue to check every frame.
 

SoVes

Member
can't you do something like so it would only trigger that frame
Code:
if keyboard_check_pressed(vk_anykey){
var current_key = keyboard_lastkey;
}
 
Top