6. Python Game Development in Hindi - Add Shapes
import pygame
pygame.init()
white = (255,255,255)
black = (0,0,0)
red = (255,0,0)
green = (0,255,0)
blue = (0,0,255)
gameWindow = pygame.display.set_mode((800,600))
pygame.display.set_caption('Snake Game')
pygame.display.update()
gameClose = False
background_image = pygame.image.load("background.jpg").convert()
while not gameClose:
for event in pygame.event.get():
if event.type == pygame.QUIT:
gameClose = True
gameWindow.blit(background_image,[0,0])
pygame.draw.line(gameWindow,white,[0,0],[50,30],6)
pygame.draw.rect(gameWindow,red,[75,10,25,25])
pygame.draw.polygon(gameWindow,black,[[100,100],[0,200],[200,200]],5)
pygame.draw.circle(gameWindow,blue,[400,300],70,6)
pygame.display.update()
pygame.quit()
quit()
YouTube :
0 Comments