STAY WITH US

5. Python Game Development in Hindi - Image Background

5. Python Game Development in Hindi - Image Background


Code : 

import pygame

pygame.init()


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.display.update()

pygame.quit()

quit()

YouTube : 



Post a Comment

0 Comments