If you load the map, during the moving loop. Add this line in the above code as a condition of the if statement If Bgget 0,x,y,1 !=0 && BT...