Simple piece of code as example how to use KeyPad and Arrow Keys to move player. Feel free to use as you want.

``````' With this piece of code you can use KeyPad
' with out wondering if NumLock pressed on or not

DECLARE SUB Keys ()
DIM SHARED x AS INTEGER, Y AS INTEGER, OldX AS INTEGER, OldY AS INTEGER
x = 40 : y = 25

SCREEN 0 : WIDTH 80, 50 : CLS : COLOR 1

DO
LOCATE x, Y:PRINT CHR\$(1) ' prints CHR\$(1)
CALL Keys ' moves on sub
LOOP

' From here starts sub Keys!!!

SUB Keys

' Let's start looping
DO
i\$ = INKEY\$
LOOP WHILE i\$ = ""

OldX = x : OldY = y ' let's save old x & y
LOCATE OldX, OldY:PRINT CHR\$(255) ' clears old position

'Let's read what you pressed ;)
IF i\$ = CHR\$(55) OR i\$ = CHR\$(0) + CHR\$(71) THEN x = x - 1: y = y - 1 ' if pressed 7 or HOME
IF i\$ = CHR\$(51) OR i\$ = CHR\$(0) + CHR\$(81) THEN x = x + 1: y = y + 1 ' if pressed 3 or PgDn
IF i\$ = CHR\$(49) OR i\$ = CHR\$(0) + CHR\$(79) THEN x = x + 1: y = y - 1 ' if pressed 1 or END
IF i\$ = CHR\$(57) OR i\$ = CHR\$(0) + CHR\$(73) THEN x = x - 1: y = y + 1 ' if pressed 9 or PgUp
IF i\$ = CHR\$(56) OR i\$ = CHR\$(0) + CHR\$(72) THEN x = x - 1 ' if pressed 8
IF i\$ = CHR\$(52) OR i\$ = CHR\$(0) + CHR\$(75) THEN y = y - 1 ' if pressed 4
IF i\$ = CHR\$(50) OR i\$ = CHR\$(0) + CHR\$(80) THEN x = x + 1 ' if pressed 2
IF i\$ = CHR\$(54) OR i\$ = CHR\$(0) + CHR\$(77) THEN y = y + 1 ' if pressed 6

' If ESC pressed...
IF i\$ = CHR\$(27) THEN END

' One way to make sure you cant get out of screen =)
IF x < 1 THEN x = 1
IF x > 80 THEN x = 80
IF y < 1 THEN 1 = 1
IF y > 50 THEN y = 80

END SUB```
```