# Welcome to my Basic games in python!

## My pong game

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

In the line thiree 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 thiree numbers from 0 to 255. the first number the red color 209, thatis a reddish color, the second number 14 is green color and the third number 200 is blue

``` ```
WIDTH = 1000
HEIGHT = 650

ball = Rect((250, 450), (35, 35))
bat = Rect((200, 480), (250, 30))
vx = 5
vy = 5

def draw():
screen.fill((34,240,224))
screen.draw.filled_rect(ball, "purple")
screen.draw.filled_rect(ball, "green")

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 += 5
elif(keyboard.left):
bat.x -=5

By: Sergi Bargués :)

``````