import pygame import random # default WIDTH=1280 HEIGHT=1060 FPS=60 sum=0 # set color WHITE=(255,255,255) BLACK=(0,0,0) RED=(255,0,0) GREEN=(0,255,0) BLUE=(0,0,255) color=[WHITE,RED,GREEN,BLUE] # set Block class class Block(pygame.sprite.Sprite): def…