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