Welcome to my Basic games in python!

My pong game

In the code below the first two lines define the screen size in pixel

In the line three and four define the ball and bat position and size

The line five and six define the speed or velocity of the ball

def is a funtion named draw. It drwas the screen with a color. The color is produced with three numbers from 0 to 255. The first number the red color 209, that is a reddish color, the secon number is green color and the third number is blue color/p>

Here is the color rgb 209, 14, 200


WIDTH = 1000
HEIGHT = 650

ball = Rect((150, 400), (35, 35))
bat = Rect((200, 480), (250, 35))
vx = 4
vy = 4

def draw():
    screen.fill((50,200,224))
    screen.draw.filled_rect(ball, "black")
    screen.draw.filled_rect(bat, "grey")

def update():
    global vx, vy
    ball.x += vx
    ball.y += vy
    if ball.right > WIDTH or ball.left < 0:
        vx = -vx
    if ball.colliderect(bat) or ball.top < 0:
        vy = -vy
    if ball.bottom > HEIGHT:
        exit()
    if(keyboard.right) :
        bat.x += 4
    elif(keyboard.left):
        bat.x -= 4