Bresenham's Algorithm
This is an example of an option of an algorithm to make a line only using whole coordinate points. This is called Brenham Algorithm.
What do you noticed about the boxes when you change the line's slope?
What reason do you think that the line only goes from 0 degrees to 45 degrees? Is there something about the way the boxes move that would have to change if it crossed one of those lines?