Game: Ping Pong Libraries used: 1) pygame 2) Math 3) Random Version: Python 3.7 Python Code: -------------------------------------------------------------------------------------------------------------------------- import pygame import math import random pygame.init() dis=pygame.display.set_mode((600,400)) gameover=False white=(255,255,255) black=(0,0,0) red=(255,0,0) blue=(0,0,255) col=(0,255,0) x1=575 y1=200 dx1=0 dy1=0 x2=25 y2=185 dx2=1 dy2=0 c=0 t=0 font_style = pygame.font.SysFont(None, 50) def message(msg,color): mesg = font_style.render(msg, True, color) dis.blit(mesg, [300, 200]) font_style1 = pygame.font.SysFont(None, 30) def show(msg,color): mesg = font_style1.render(msg, True, color) dis.blit(mesg, [300, 10]) clock=pygame.time.Clock() while not gameover: for event in pygame.event.get(): ...
I am Vishnu Prasad Dalai, pursuing electrical engineering from NIT Rourkela. This blog consists of all the projects I have worked on. My hobbies are playing badminton, traveling, reading and drawing sketches.