Skip to content

keyboard_clear

drewmccluskey edited this page Feb 12, 2019 · 2 revisions

keyboard_clear

This will delete the state of a key

Syntax:

keyboard_clear(Keys key)
Argument Description
Keys key Which key to clear the state of

Returns: bool

Description:

This function will clear the state of a specified key. So when you are using keyboard_check(key); and holding your selected key and then use keyboard_clear(key); for that key, keyboard_check(key); should return false, for returning true again the user must release the key and then press it again.

Example:

if (keyboard_check(Keys.D))
{
    Position.X += 5;
}

if (keyboard_check(Keys.A))
{
    keyboard_clear();
}

This code will move your object to the right when you held down the D key. When you press A on the keyboard the moving object should stop and will not move again until the D key is released and pressed again.

Back to Keyboard

Clone this wiki locally