Novelty scripting reference > Scripted events > OnKeyDown

OnKeyDown

This event is triggered a keyboard key has been pressed.


Implicit arguments

KeyCode keyCode
The key that was pressed.


Sample

event Sample.OnKeyDown
{
	// Print out the key that was pressed
	Print("Key pressed: " + KeyName(keyCode));

	switch (keyCode)
	{
	case KEY_LEFT:
		Print("Move left");
		break;
	case KEY_RIGHT:
		Print("Move right");
		break;
	}	
}

Back to top