Welcome to my Basic games in python!

My pong game

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

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 draws 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 second number 14 is green color and the third number 200 is blue color

Here is the color rgb 209,14,200

  
WIDTH = 750
HEIGHT = 600

ball = Rect((150, 400), (30, 30))
bat = Rect((200, 480), (150, 25))
vx = 5
vy = 5

def draw():
    screen.fill((209,14,200))
    screen.draw.filled_rect(ball, "black")
    screen.draw.filled_rect(bat, "blue")

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