Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DIM X AS INTEGER, Y AS INTEGER
- DIM sKey AS STRING
- X = 1: Y = 1 ' Coordinates for LOCATE start at (1, 1)
- DO
- sKey = INKEY$ ' Read a key from the keyboard
- IF sKey = CHR$(0) + CHR$(72) THEN ' Up
- Y = Y - 1
- ELSEIF sKey = CHR$(0) + CHR$(80) THEN ' Down
- Y = Y + 1
- ELSEIF sKey = CHR$(0) + CHR$(75) THEN ' Left
- X = X - 1
- ELSEIF sKey = CHR$(0) + CHR$(77) THEN ' Right
- X = X + 1
- END IF
- CLS
- LOCATE Y, X: PRINT "O"
- LOOP UNTIL sKey = CHR$(27) ' exit when pressed escape
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement