You can do it with 2 global variables for up and down movement that start at 0
Then you number the locks across with matching var1 and var 2 instance variables as if it was a grid, so top left is 0,0. The second one across the top row would be 0,1 etc.
Then you have logic, on right pressed, add 1 to var1. On left pressed, subtract 1 from var1. On down pressed add 1 to var2, on up pressed add 1 to var2.
Then you need the final bit of logic set hand position to lock where lock.var1=var1 AND lock.var2=var2