I started a new game using pygame its called Space Invaders and this is the code I have for now
import pygame
import os
import time
import random
pygame.font.init()
WIDTH, HEIGHT = 600, 600
WIN = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("Space Shooter Game | korsat x parmaga ")
main_font = pygame.font.SysFont("comicsans", 35)
lost_font = pygame.font.SysFont("comicsans", 45)
def collide(obj1, obj2):
offset_x = obj2.x - obj1.x
offset_y = obj2.x - obj1.y
return obj1.mask.overlap(obj2.mask, (offset_x, offset_y)) != None
def draw_lives(lives):
lives_label = main_font.render(f"Lives: {lives}", 1, (255, 255, 255))
WIN.blit(lives_label, (10, 10))
Leave a Reply