Snake game in python <p>author = 'CodeWithHarry' #Importing The Modules import pygame import random import os #Initialization pygame.mixer.init() pygame.init() #Colors white = (255, 255, 255) red = (255, 0, 0) black = (0, 0, 0) snakegreen = (35, 45, 40) #Game Backgrounds # bg1 = pygame.image.load("Screen/bg.jpg") bg2 = pygame.image.load("Screen/bg2.jpg") intro = pygame.image.load("Screen/intro1.png") outro = pygame.image.load("Screen/outro.png") #Creating The window screen_width = 900 screen_height = 600 gameWindow = pygame.display.set_mode((screen_width, screen_height)) #Game Title pygame.display.set_caption("Snake By CodeWithHarry") pygame.display.update() #Music pygame.mixer.music.load('music/wc.mp3') pygame.mixer.music.play(100) pygame.mixer.music.set_volume(.6) #Variables For The Game clock = pygame.time.Clock() font = pygame.font.SysFont(...
Posts
Showing posts from October, 2023