Posts

How to make SPACE INVADERS using Pygame in Python

DO MAKE SURE TO VISIT MY CHANNEL :) import pygame, random pygame.init() health = 100 score = 0 display = pygame.display.set_mode((1200, 673)) bg = pygame.image.load("space.png") player = pygame.image.load("player.png") enemy = pygame.image.load("enemy.png") bullet = pygame.image.load("bullet (2).png") bullet_2 = pygame.image.load("bullet (2).png") bullet_3 = pygame.image.load("bullet (2).png") player_x = 550 player_y = 500 player_bullet = pygame.image.load("bullet (2).png") player_bullet_x = player_x-10 player_bullet_y = player_y+20 enemy_x = random.randint(0, 1000) enemy_2_x = random.randint(0, 1000) enemy_3_x  = random.randint(0, 1000) enemy_y = 0 enemy_bullet_x = enemy_x+17 enemy_bullet_2_x = enemy_2_x+17 enemy_bullet_3_x = enemy_3_x+17 enemy_bullet_y = enemy_y+25 running = True while running:     font = pygame.font.SysFont(None, 40 )     display.blit(bg, (0, 0))     text = font.render(f'Score: {score}', T...

How to make Chess game using Python, Pygame

 Note: There are different files in this project which are separated by different headings throughout this post. 1. Main.py import pygame from classes . Board import Board pygame . init () WINDOW_SIZE = ( 600 , 600 ) screen = pygame . display . set_mode (WINDOW_SIZE) board = Board (WINDOW_SIZE[ 0 ], WINDOW_SIZE[ 1 ]) def draw ( display ):     display .fill( 'white' )     board. draw ( display )     pygame . display . update () if __name__ == '__main__' :     running = True     while running:         mx, my = pygame . mouse . get_pos ()         for event in pygame . event . get ():             if event.type == pygame .QUIT:                 running = False             elif event.type == pygame .MOUSEBUTTONDOWN:                 if event.b...