In HTML5, we do this with an “interval” timer, like an interrupt, where every X milliseconds, we run the function. In turn, it erases the visible characters (sprites), updates the movements, checks for collisions, and re-draws them in their new locations.