Posts

Snake game using pygame library

Image
Snake game using pygame library getting started with pygame library open your command prompt and write:          pip install pygame or you can find much info on pygame website  you can either copy and paste the below code to your idle or download the whole code along with background images and background audio files from here import pygame import os import sys import random import time check=pygame.init() if(check[1]>0):     print('pygame can\'t be successfully initialized')     sys.exit(0) else:     print('pygame successfully initialized') playsurface=pygame.display.set_mode((800,600)) pygame.display.set_caption("snake game") """#colors blue=pygame.Color(0,128,0) #loading background music pygame.mixer.music.load("music.mp3") pygame.mixer.music.set_volume(0.5) pygame.mixer.music.play(-1)      #for looping -1 means it,ll keep on playing endlessly 2 means it'll play 2 time...