3.5 inch screen moving objects & collision

title and here

[b]for(int x = 1; x < 431; x++) {
    tft.fillRect(0+x, 220, 50, 50, WHITE);
    tft.fillRect(-50+x, 220, 50, 50, BLUE);

above code makes box moving in x axis and that box leaves trace I need to cover with other trace seen here “tft.fillRect(-50+x, 220, 50, 50, BLUE);

my friend is currently making next level program 1337 real stuff and he laughing so much when I try to figure out something like this :/. Gonna remove & comment when I figure it out if I do