(AGK version: 108.14)
Submitted: 2013-11-13 05:25:20
// Create Sprite
CreateSprite (1,0)

do

  x# = GetSpriteX(1)
  y# = GetSpriteY(1)

  // Move Sprite to Right
  if GetRawKeyState( 39 )

    SetSpritePosition ( 1, GetSpriteX( 1 ) + 2, GetSpriteY( 1 ) + 0 )

  ENDIF

  // Move Sprite to Left
  if GetRawKeyState ( 37 )

    SetSpritePosition ( 1, GetSpriteX( 1 ) - 2, GetSpriteY ( 1 ) + 0 )

  ENDIF

  Sync()
loop
(AGK version: 108.21)
Submitted: 2014-05-09 23:16:37
// Create Sprite
Player = CreateSprite( LoadImage( "player.png" ) )

Do

    x# = GetSpriteX(Player)
    y# = GetSpriteY(Player)

    // Move Sprite To Left
    If GetRawKeyState ( 37 )
        SetSpritePosition ( Player, GetSpriteX( Player ) - 3, GetSpriteY( Player ) + 0 )
    EndIf

    // Move Sprite Up
    If GetRawKeyState ( 38 )
        SetSpritePosition ( Player, GetSpriteX( Player ) + 0, GetSpriteY( Player ) - 3 )
    EndIf

    // Move Sprite To Right
    If GetRawKeyState( 39 )
        SetSpritePosition ( Player, GetSpriteX( Player ) + 3, GetSpriteY( Player ) + 0 )
    EndIf

    // Move Sprite Down
    If GetRawKeyState ( 40 )
        SetSpritePosition ( Player, GetSpriteX( Player ) + 0, GetSpriteY( Player ) + 3 )
    EndIf

    Sync()
Loop
(AGK version: 108.24)
Submitted: 2014-11-21 18:18:30
// Create Sprite
CreateSprite (1, 0)

/********************************************************
	GetRawKeyState should use the constants defined at 
	http://www.appgamekit.com/documentation/guides/scancodes.htm 
********************************************************/	
 
#constant KEY_LEFT   37
#constant KEY_UP     38
#constant KEY_RIGHT  39
#constant KEY_DOWN   40 

delta_x = 0
delta_y = 0

do
	x# = GetSpriteX(1)
	y# = GetSpriteY(1)
	
	if GetRawKeyState( KEY_LEFT )
		// Move Sprite to Left
		delta_x = -2
		delta_y = 0
		SetSpritePosition ( 1, GetSpriteX( 1 ) + delta_x, GetSpriteY ( 1 ) + delta_y )
	elseif GetRawKeyState ( KEY_UP )
		// Move Sprite Up
		delta_x = 0
		delta_y = -2
		SetSpritePosition ( 1, GetSpriteX( 1 ) + delta_x, GetSpriteY ( 1 ) + delta_y )
	elseif GetRawKeyState ( KEY_RIGHT )
		// Move Sprite to Right
		delta_x = 2
		delta_y = 0
		SetSpritePosition ( 1, GetSpriteX( 1 ) + delta_x, GetSpriteY ( 1 ) + delta_y )
	elseif GetRawKeyState ( KEY_DOWN )
		// Move Sprite to Down
		delta_x = 0
		delta_y = 2
		SetSpritePosition ( 1, GetSpriteX( 1 ) + delta_x, GetSpriteY ( 1 ) + delta_y )
	endif
	
	Sync()
loop 
(AGK version: 2017.1.9)
Submitted: 2017-01-25 22:15:56
rem
rem AGK Application 2017.01.09
rem MR 25.01.2017

SetWindowSize(1280,720,0)
SetVirtualResolution(100,100)


local i as Integer

Do

    for i=0 to 255
	 if GetRawKeyState(i) then print("Key "+str(i)+" State "+str(GetRawKeyState(i)))
	next

	If GetPointerPressed()
		exit
	EndIf
	
	sync()
Loop
end
	
Help make AGK better by submitting an example for this command!
(All examples are subject to approval)
Login to post an example of your own.